Hi I wonder if anyone can help,
I'm fairly new to ADO.NET and am trying to create a program that picks up a value from one table in access, displays it in a command prompt and then copies selected data to another table. My code i am having problems with is below. The Declared values are the ones I wish to write to a table and when I put in break points and step through the values are shown correctly, however when I get to the Execute query at the bottom I get the following error. Any Ideas? Thanks all help appreciated.
"No value given for one or more required parameters".
Dim myOleDbConnection As OleDb.OleDbConnection
Dim insert As String
Dim value1 = objDataRow.Item("ContactID")
Dim value2 = objDataRow.Item("FirstName")
Dim value3 = objDataRow.Item("LastName")
Dim value4 = objDataRow.Item("Sent")
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = C:\Users\Edward\Desktop\db1.mdb;"
'insert = "INSERT INTO Cancelled (ContactID, FirstName, LastName, Sent) VALUES (" & value1 & " ," & value2 & " ," & value3 & " ," & value4 & ")"
myOleDbConnection = New OleDb.OleDbConnection(myConnectionString)
myOleDbConnection.Open()
Dim myOleDbCommand As New OleDb.OleDbCommand(insert, myOleDbConnection)
myOleDbCommand = myOleDbConnection.CreateCommand
myOleDbCommand.CommandType = CommandType.Text
myOleDbCommand.CommandText = insert
myOleDbCommand.ExecuteNonQuery()
myOleDbConnection.Close()
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).