In This code i am trying to update my excel sheet in mysql but i am getting this error please help me some suggestions
i my excel sheet starting column is WDS_id
Sub updateData()
Dim cn As New ADODB.Connection
Dim wds_id, nRows
cn.ConnectionString = "Provider = MSDASQL.1; Persist Security Info = False;Data Source = mysql32; User ID = root;Password = bmx1; Initial Catalog = wds"
cn.CursorLocation = adUseClient
cn.Open
Dim i As Integer, QryTxt As String
i = startingrow(wds_id)
Do Until i = Sheet1.Rows.count
If Sheet1.Cells(i, 1) = "" Then
nRows = i - 1
Exit Do
End If
i = i + 1
Loop
For i = startingrow(wds_id) To nRows
QryTxt = QryTxt & "update tblprod_agr_006 set column1 = '" & Replace(Sheet1.Cells(i, 1), "'", "''") & "'," & vbCrLf
QryTxt = QryTxt & " column2 = '" & Replace(Sheet1.Cells(i, 3), "'", "''") & "'," & vbCrLf
QryTxt = QryTxt & " column3 = '" & Sheet1.Cells(i, 4) & "'," & vbCrLf
QryTxt = QryTxt & "where conditioncolumn =" & "'" & Sheet1.Cells(i, 2) & "'" & "" & vbCrLf
Next
Change cn.Execute(QryTxt)
End Sub
Bookmarks