I am trying to upload data into an Access db from vb.net. The data was parsed out from text files. Everything seems to be working fine up till the .execute point. The debugger insists there is a syntax error in my statement, but when I check my insert into statement, I get what I expect. What am I doing wrong? Here is my code.: - Dim str As String
-
Dim s As ADODB.Connection = New ADODB.Connection
-
Dim cmd As OleDbCommand
-
-
s.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & "c:\x.mdb" & ";" & "Persist Security Info=False"
-
-
-
str = "INSERT INTO IS " & _
-
"(Fi,Da,St,En,In,Ba,Wa,Bat,Ele,Ver,VS,BeD,Ee) " & _
-
" VALUES (" & strFi & "," & strDa & "," & strST & "," & strET & "," & strIn & "," & strBS & "," & strWa & "," & strBT & "," & strEer & "," & strVS & "," & strVSt & "," & strBD & "," & strEe & ")"
-
-
-
s.Execute(str)
-
-
s.Close()
3 2372
Heya, ChildProgrammer.
I award 3 points for creative use of [i] tags. Unfortunately, I have to deduct 3 points for using [i] tags when [code=vb] tags were called for.
Better luck next time.
Moving to the .NET forum....
Heya, ChildProgrammer.
I award 3 points for creative use of [i] tags. Unfortunately, I have to deduct 3 points for using [i] tags when [code=vb] tags were called for.
Better luck next time.
Moving to the .NET forum....
Leaving me with no point huh? Fair enough. lol
I am trying to upload data into an Access db from vb.net. The data was parsed out from text files. Everything seems to be working fine up till the .execute point. The debugger insists there is a syntax error in my statement, but when I check my insert into statement, I get what I expect. What am I doing wrong? Here is my code.: - Dim str As String
-
Dim s As ADODB.Connection = New ADODB.Connection
-
Dim cmd As OleDbCommand
-
-
s.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & "c:\x.mdb" & ";" & "Persist Security Info=False"
-
-
-
str = "INSERT INTO IS " & _
-
"(Fi,Da,St,En,In,Ba,Wa,Bat,Ele,Ver,VS,BeD,Ee) " & _
-
" VALUES (" & strFi & "," & strDa & "," & strST & "," & strET & "," & strIn & "," & strBS & "," & strWa & "," & strBT & "," & strEer & "," & strVS & "," & strVSt & "," & strBD & "," & strEe & ")"
-
-
-
s.Execute(str)
-
-
s.Close()
Hi ChildProgrammer :)
Check out this .NET article on how to use a database in your program. See if it helps you out.
-Frinny
Post your reply Sign in to post your reply or Sign up for a free account.
Similar topics
1 post
views
Thread by Phil Powell |
last post: by
|
6 posts
views
Thread by Matthew Louden |
last post: by
|
4 posts
views
Thread by Rachel McConnell |
last post: by
|
25 posts
views
Thread by MLH |
last post: by
|
21 posts
views
Thread by comp.lang.tcl |
last post: by
|
6 posts
views
Thread by ewpatton |
last post: by
| | | | | | | | | | | | | |