473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Syntax error in FROM clause

I use an .aspx (user control) page as follow:

<script runat="server">
Public Sub BtnSave_Click(byval obj As Object, e As EventArgs)
ReadRecords()
End Sub

Private Sub ReadRecords()

Dim conn As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("/MySiteFldr/database/Mydb.mdb"))
Dim cmd as new OleDbCommand _
("SELECT Col1 FROM myTable", conn)
Dim reader As OleDbDataReader

Try
conn.Open
reader = cmd.ExecuteReader
while reader.Read
response.write(reader.GetString(0) & "<br>")
End While

Catch e as Exception
Response.Write("Exception happened : " & e.Message)
Response.End
Finally
if not reader is nothing then
reader.Close
end if
if not conn is nothing then
conn.Close
end if
End Try

End Sub
</script>

<asp:button id=BtnSave text=Save runat=server onClick="BtnSave_Click" />

But I got the error message "Syntax error in FROM clause"
but my qurey seems to be okay !!!!

Any help will be welcome.
Thanks!

Abdel.
Nov 18 '05 #1
1 2081
Do you have a table named myTable containing a column
named Col1 in your myDb database?

Mike McIntyre
www.getdotnetcode.com
-----Original Message-----
I use an .aspx (user control) page as follow:

<script runat="server">
Public Sub BtnSave_Click(byval obj As Object, e As EventArgs) ReadRecords()
End Sub

Private Sub ReadRecords()

Dim conn As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath ("/MySiteFldr/database/Mydb.mdb")) Dim cmd as new OleDbCommand _
("SELECT Col1 FROM myTable", conn)
Dim reader As OleDbDataReader

Try
conn.Open
reader = cmd.ExecuteReader
while reader.Read
response.write(reader.GetString(0) & "<br>") End While

Catch e as Exception
Response.Write("Exception happened : " & e.Message) Response.End
Finally
if not reader is nothing then
reader.Close
end if
if not conn is nothing then
conn.Close
end if
End Try

End Sub
</script>

<asp:button id=BtnSave text=Save runat=server onClick="BtnSave_Click" />
But I got the error message "Syntax error in FROM clause"
but my qurey seems to be okay !!!!

Any help will be welcome.
Thanks!

Abdel.
.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sean | last post by:
HI There, I am trying to submit a form when a selection is made from a dropdown list, I keep getting the error "Handles clause requires With Events Variable". Could someone help me with the...
3
by: Jerry | last post by:
Well, here is some weirdness. First, I noticed that I have 2 Set keywords (silly me). so I removed the 2nd "Set" but still got a syntax error. Then I removed the Where clause, and now it works...
2
by: Bob Alston | last post by:
I am going blind tonight but I cannot figure out the error. I get a syntax error from this sql statement, being run via vba in access 2003 insert into tbl_Volunteer_Donor in...
2
by: isaac2004 | last post by:
hello i am getting a weird al syntax error from my SQL statement Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error (missing operator) in query expression...
11
by: Frankie | last post by:
Hello: New user here...first post to group. I'm getting an SQL syntax error when I try to run the following query: $query = sprintf("SELECT itemNumber, entryDate, modifyDate, thumbnailURL,...
1
by: darrel | last post by:
hi there can anyone tell me wats wrong with my program, its a like this i have a database called "dbTimescheduling", with a field with a name of "Time",,, for now i want to do is to be able to access...
3
by: bilbo | last post by:
Can anybody help me understand why I get the error "Syntax error in CONSTRAINT clause"? I get it in Access 2003 and Access 2007. Both are clean installs with no add-ins Running this code in...
5
by: stanman | last post by:
I have been trying to get past this error all day. I am unable to determine why I get syntax error from the following code: //modify a record $myDataID = mysql_query("UPDATE members SET...
20
by: billmaclean1 | last post by:
I need to write a stored procedure that selects from a table and returns the result set. I don't always know the TableSchema that I need to use when qualifying the table at run-time Example:...
11
guillermobytes
by: guillermobytes | last post by:
Hi, i'm making a query with PDO and there is a SQL syntax error in it. $sql = 'BAD CODE'; $pdoStmt = $pdo->prepare($sql); if (false === $pdoStmt) { echo 'ERROR'; }
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.