Run time error '-2147217908(80040e0c)':
command text was not set for the command object
i have 42 columns i wanted to update whole sheet
i have using this code to update by excel data to mysql
Dim i As Integer, QryTxt As String
i = 1
' startrow = 1
'i = startingrow(Number)
Do Until startrow = Sheet1.Rows.count
If Sheet1.Cells(i, 1) = "" Then
nRows = startrow
Exit Do
End If
i = i + 1
Loop
For i = 1 To nRows
QryTxt = QryTxt & "update tblprod_agr_006 set column1 = '" & Replace(Sheet1.Cells(i, 1), "'", "''") & "'," & vbCrLf
QryTxt = QryTxt & " column2 = '" & Replace(Sheet1.Cells(i, 1), "'", "''") & "'," & vbCrLf
QryTxt = QryTxt & " column3 = '" & Sheet1.Cells(i, 1) & "'," & vbCrLf
QryTxt = QryTxt & "where wds_id =" & "'" & Sheet1.Cells(i, 1) & "'" & "" & vbCrLf
Next
cn.Execute (QryTxt)
Bookmarks