ASP Forum
Join table
steve21 | Posted 10:34am 4. September 2007 Server Time |

Hi There,
I am having problem to join the table
Please help
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

My DB (access)
tblstudent
lno = auto
student_no = primary key
lname
dob
password

tblenrol
lno = auto
module_no = primary key
student_no
semester
lyear




My code
Set MyAccount = Server.CreateObject("ADODB.Connection")
ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)};"
ConnStr = ConnStr & "DBQ=" & Server.MapPath("db\college.mdb")
MyAccount.Open(ConnStr)

SQLtemp = "SELECT student_no.student_no, student_no.lname,student_no.dob,student_no.lpassword, student_no.module_no,student_no.semester, student_no.lyear FROM tblenrol AND tblstudent WHERE student_no = '" & Request.Cookies("StudentID") & "' "
Set rs = MyAccount.Execute(SQLtemp)

while not rs.eof

If Request.Cookies("StudentID") = rs("student_no") Then

dim Your_StudentID
Your_StudentID = rs("student_no.student_no")
dim Your_Name
Your_Name = rs("student_no.lname")
dim Your_DOB
Your_DOB = rs("student_no.dob")
dim Your_Password
Your_Password = rs("student_no.lpassword")
dim Your_Module_No
Your_Module_No = rs("student_no.module_no")
dim Your_Semester
Your_Semester = rs("student_no.semester")
dim Your_Year
Your_Year = rs("student_no.lyear")
dazlamb | Posted 1:37am 7. September 2007 Server Time |

Try 'FROM tblenrol,tblstudent' instead of 'FROM tblenrol AND tblstudent'


Reply to Post Join table



Back to Forum Page