\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Syntax error in INSERT INTO statement.


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
Sorry to bother everyone tonight but I\'m just not seeing what I\'m doing
\r\nwrong with this code. It\'s the \'cn.Execute\'s insert line. I\'ve went so far
\r\nas removing my var\'s and hard coding the line with data but I\'m still not
\r\nseeing what I\'m doing wrong.
\r\n
\r\nCan anyone help?
\r\n
\r\n
\r\n
\r\n
Code:
\r\n
Sub DB_Creation()\r\n\r\nDim cn As ADODB.Connection\r\n \r\n Set cn = New ADODB.Connection\r\n dbfilename$ = frmMain.Combo1.Text & ".mdb"\r\n \r\n If Dir$(App.Path & "\\" & dbfilename$) = "" Then Call CreateDataBase\r\n If Dir$(App.Path & "\\" & dbfilename$) = dbfilename$ Then\r\n cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\\" & dbfilename$\r\n cn.Execute "INSERT INTO AA3(Module, Game) VALUES(\'test1\', \'test2\')"\r\n cn.Close\r\n End If\r\n\r\nEnd Sub
\r\n
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[956602] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 03-05-2005, 10:04 PM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Bart1123\r\n Bart1123 is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 03-05-2005, 09:51 PM
bradac bradac is offline
Regular
 
Join Date: Sep 2001
Location: Mokane, MO
Posts: 98
Question Syntax error in INSERT INTO statement.


Sorry to bother everyone tonight but I'm just not seeing what I'm doing
wrong with this code. It's the 'cn.Execute's insert line. I've went so far
as removing my var's and hard coding the line with data but I'm still not
seeing what I'm doing wrong.

Can anyone help?


Code:
Sub DB_Creation() Dim cn As ADODB.Connection Set cn = New ADODB.Connection dbfilename$ = frmMain.Combo1.Text & ".mdb" If Dir$(App.Path & "\" & dbfilename$) = "" Then Call CreateDataBase If Dir$(App.Path & "\" & dbfilename$) = dbfilename$ Then cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & dbfilename$ cn.Execute "INSERT INTO AA3(Module, Game) VALUES('test1', 'test2')" cn.Close End If End Sub
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->