|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to insert some data from a windows form to a access database.
Here is a bit from my code where the error occurs: rows = countRowsInDatabase() getDataString = String.Concat("INSERT INTO dates (Id,Task,year, month, day, hour, minute, beskrivning) VALUES ('", rows, "','", TextBox2.Text, "', '", yearString, "', '", monthString, "', '", dayString, "', '", hourString, "', '", minuteString, "', ", TextBox1.Text, "')") TextBox1.Text = getDataString Try DBcon1.Open() myOledbCommand.Connection = DBcon1 myOledbCommand.CommandText = getDataString myOledbCommand.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.ToString) Finally DBcon1.Close() myOledbCommand.Dispose() End Try End If Me.Close() End Sub The error message is syntax error in INSERT INTO expression. Can anyone see what I am doing wrong? /HuGo Last edited by HuGo : July 9th, 2003 at 07:53 AM. |
|
#2
|
|||
|
|||
|
Whenever you have problems like this, print your SQL string and look at it. Often you'll see the problem right away. Otherwise, copying it and running it directly against the database will tell you what's wrong.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > VB.net INSERT problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|