Hi all, I am just relearning VB and so far it is a long road, many things have changed since v4. All of this .NET is new to me so please bear with me. I have been seraching the web for tips and help but i have hit a stumbling block that I see no reason why it should fail.
I am using VB Express trying to connect to a local Access database to update a field that i specifiy. This is just the begining of the project, in the long run the project will be taking command promt variables to fill in the database names so I am trying to avoid tying the database to the program with Add New DataSource from the menu bar.
Well, here is the code snippet that is giving me problems. Some of the variable are defined elsewhere and no errors pop up when running the program.
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\database\axx_ss.mdb'"
updateString = "UPDATE " & tableNameString & " SET UploadDateTime = '" & Now & "' WHERE ID = " & dr(0)
cn.Open()
Dim updateCmd As New OleDbCommand(updateString, cn)
updateCmd.ExecuteNonQuery()
' Return a success message.
If rows_affected <= 1 Then
Res.Text = "Ok." & vbCrLf
Else
Res.Text = "Ok. " & rows_affected & " rows affected" & vbCrLf
End If
cn.Close()
updateString = "UPDATE UUT_RESULT SET UploadDateTime = '1/18/2007 12:26:25 PM' WHERE ID = 142"
The catch error I get is : No value given for one or more required parameters.
I just can't see any problems.
Thanks for any help
Dean
I am using VB Express trying to connect to a local Access database to update a field that i specifiy. This is just the begining of the project, in the long run the project will be taking command promt variables to fill in the database names so I am trying to avoid tying the database to the program with Add New DataSource from the menu bar.
Well, here is the code snippet that is giving me problems. Some of the variable are defined elsewhere and no errors pop up when running the program.
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\database\axx_ss.mdb'"
updateString = "UPDATE " & tableNameString & " SET UploadDateTime = '" & Now & "' WHERE ID = " & dr(0)
cn.Open()
Dim updateCmd As New OleDbCommand(updateString, cn)
updateCmd.ExecuteNonQuery()
' Return a success message.
If rows_affected <= 1 Then
Res.Text = "Ok." & vbCrLf
Else
Res.Text = "Ok. " & rows_affected & " rows affected" & vbCrLf
End If
cn.Close()
updateString = "UPDATE UUT_RESULT SET UploadDateTime = '1/18/2007 12:26:25 PM' WHERE ID = 142"
The catch error I get is : No value given for one or more required parameters.
I just can't see any problems.
Thanks for any help
Dean