Getting error as Run-time error '-2147467259(800004005)': Automation error Unspecified error in the rs.update statment.
New to Excel Macro and doing it for the first time. Please help
Below is the code used
Sub dbconnection()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sqlstr As String
Dim strconn As String
strconn = "Driver={SQL Server};Server=testing;Database=testdb;UID=sa;PWD=s123*"
cn.Open strconn
sqlstr = "select * from testing124(nolock)"
rs.Open sqlstr, strconn, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!ID = Cells(2, "a").Value
rs!remarks = Cells(3, "a").Value
rs.Update
rs.Close
cn.Close
Set cn = Nothing