MySQL Forums
Forum List  »  Microsoft Access

Trouble with SELECT clauses when migrating from Access
Posted by: Jakob Hellquist
Date: April 12, 2005 08:47AM

Hi,

I just started migrating our website from Access to MySQL, and I can't get some of the SQL clauses to work. It worked perfectly with Access, and the connection to mysql is fine, but the html tables with the data are blank as soon as I switch to mysql.

I guess there is something in the syntax that should be changed; brackets, parentheses... - any suggestions would be highly appreciated!

/Jakob


Set Database = Server.CreateObject("ADODB.Connection")
Database.Open "PROVIDER=MSDASQL;" & _
"DRIVER={MySQL ODBC 3.51 Driver};" & _
"DBQ="&myserver&";" & _
"UID=myDB;PWD=myPwd;"


' Getting the data
Set rsAnswers = Server.CreateObject("ADODB.Recordset")
sql="SELECT CorrectAnswerId, CourseID, ExerciseID, ExerciseSubID, CorrectAnswer, ExerciseItemId FROM CorrectAnswers WHERE ExerciseId="& iExerciseId &" AND ExerciseSubId ="& Request.Form("exercisesubid") &" ORDER BY ExerciseItemId"
rsAnswers.Open sql, Database, 3, 3

-----------------and another SELECT clause:

Set rsMistakes = Server.CreateObject("ADODB.Recordset")
sql="SELECT CommonMistakeId, CommonMistake, TeachersComment FROM CommonMistakes WHERE CorrectAnswerId="& rsAnswers.Fields("CorrectAnswerId").Value &" ORDER BY CorrectAnswerId"
rsMistakes.Open sql, Database, 3, 3

-----------------and an INSERT clause:

sql="INSERT INTO ToComment (CorrectAnswerId, SubmittedAnswer, StudentQueryName) VALUES ("& rsAnswers.Fields("CorrectAnswerId").Value &", '"& arExerciseItemId(i) &"', '"& myStudent &"')"
rsComments.Open sql, Database, 3, 3

Options: ReplyQuote


Subject
Views
Written By
Posted
Trouble with SELECT clauses when migrating from Access
2687
April 12, 2005 08:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.