且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在数据表中添加行时出现问题

更新时间:2023-12-01 19:57:40

您好,Ujjwal,

我看到两个新的行语句彼此不同


Hi Ujjwal,

As I see two new row statements different from Each other


Dim dr As DataRow = dt_Main1.NewRow()


Dim dr As DataRow = ds.Tables("Months").NewRow()



因此,我认为两个DataTable的结构不匹配,您尝试在



So as I think two DataTable''s struct mismatch and you try to add new rows at

dt_Main1

处添加新行,因为这会在其他部分抛出错误
但您提到

there for its throw an error on else part
but you mentioned

On Error Resume Next

继续执行.

结果,它仅执行If部分,而不执行else部分.

there for it continue execution.

As a result it only perform If part and not the else part.