Syntax Error in From Clause

TheWizardofInt

Well-known member
Joined
Dec 31, 1969
Messages
333
Location
Orlando, FL
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:

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
 
Try:
Select * From [Counter] where [pwd] =

Also, youre 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
 
Back
Top