TheWizardofInt Posted May 9, 2003 Posted May 9, 2003 This is a new problem I created a new Access database with one table, with 2 fields and a key field No matter what SQL query I use on it, it says, "Syntax Error in From Clause" when I try to write the information to a DataSet Here is some code: Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database/VARS.mdb") & ";" Dim strSQL As String = "Select * From Counter Where pwd = 'xyz123'" Dim oConn As New SysADO.OleDbConnection(strConn) Dim oCommand As New SysADO.OleDbCommand(strSQL, oConn) Dim oDA As New SysADO.OleDbDataAdapter(oCommand) Dim oDS As New System.Data.DataSet() Dim oDr As DataRow oConn.Open() oDA.Fill(oDS, "Counter") oDr = oDS.Tables("Counter").Rows(0) Dim sNumber As String = CStr(oDr("Login")) Dim lNumber As Long ' Build our SQL query lNumber = Val(sNumber) + 1 sNumber = CStr(lNumber) oConn.Close() The code works if I rename everthing to an older Access database and record set Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
*Experts* Nerseus Posted May 9, 2003 *Experts* Posted May 9, 2003 Try: Select * From [Counter] where [pwd] = Also, you're better off listing out the columns you want instead of using *. First, because you can easily see what columns exist, and second because you can bracket them as well, in case their names are reserved words. Select [FirstName], [LastName] From [Counter] Where [Pwd] = ... -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
TheWizardofInt Posted May 9, 2003 Author Posted May 9, 2003 That worked Thanks so much, and that is what I shall do Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.