额,新手,我也不知道有没有触发Datacolchanged事件,部分代码如下:
'行内容处理
Rg = Ws.Range("A7:L50007") '5w行数据
For i As Integer= 2 To Rg.Rows.Count '行数 第一行标题舍弃
If Rg.Cells(i,1).value <>0 Then '计算Id不为空
maxId=maxId+1
sSQL ="insert into " & DataName & " values('" & maxId & "','" & intime & "','" & time & "',"
For j As Integer= 1 To Rg.Columns.Count '列数
If j=7 Then
value(j-1)=sId '业务名称换成Id
Else
value(j-1)=Rg.Cells(i,j).value
End If
If value(j-1)<>"" Then
sSQL=sSQL & "'" & value(j-1) & "',"
Else
sSQL=sSQL & "NULL" & ","
End If
If j =Rg.Columns.Count Then
sSQL=sSQL & "'0',NULL)"
End If
Next
zSQL =zSQL & sSQL & ";"
End If
Next
cmd.CommandText = zSQL
cmd.ExecuteReader()
zSQL=""