Background: VB6(w/Service Pack 5), Windows XP, Access 2000 \r\n \r\nJust read a basic ADO tutorial here, but as I inputed the code I was informed of a Syntax Error in the following line: \r\n \r\nMyConn.Execute ("UPDATE Users(User Name) VALUES(\'Ben\')") \r\n \r\nIn my database, I have a table named Users, and a column named User Name. \r\n \r\nIdeally, I want this code to add a new row and input a string in the appropriate field. But after numerous errors, I have scaled it down to a simple update command, and still recieve a syntax error. What am I doing wrong? \r\n \r\nFull Code: \r\n \r\nDim MyConn As ADODB.Connection \r\nDim strPath As String \r\n \r\nPrivate Sub cmdNew_Click() \r\n \r\nstrPath = App.Path \r\nSet MyConn = New ADODB.Connection \r\n \r\nMyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "\\Nascar.mdb;" \r\n \r\nMyConn.Open \r\n \r\nMyConn.Execute ("UPDATE Users(User Name) VALUES(\'Ben\')") \r\n \r\nMyConn.Close \r\nEnd Sub
In my database, I have a table named Users, and a column named User Name.
Ideally, I want this code to add a new row and input a string in the appropriate field. But after numerous errors, I have scaled it down to a simple update command, and still recieve a syntax error. What am I doing wrong?
Full Code:
Dim MyConn As ADODB.Connection
Dim strPath As String
Private Sub cmdNew_Click()
strPath = App.Path
Set MyConn = New ADODB.Connection
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