Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

  • *Experts*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...