|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Invalid character when I try to connect
Hi!
I have been trying for the past week to connect to a remote MySQL database using ASP with no success at all. I continually get an error message telling me that I have an invalid character on the <% line. The code is not nested within another block of ASP code, and I have installed the MyODBC 2.50 driver in my local machine.I have been asking for help on another ASP website, and I'm being told that the code works on another machine. This is the code that is just driving me nuts: ![]() <html> <head> <title>Thank you!</title> <link rel="stylesheet" href="guest.css" type="text/css"> </head> <body> <!--This connects to the database and adds the information from the form--> <% *** ***' Creating the connection object and opens the database ***strConnection = "driver={MySQL}; server=hari; database=guestbook" _ *** & "uid=root; pwd=;" ***set con = server.createobject("adodb.connection") ***con.open strConnection ***' This adds data from the form to the database *** ** sqlInsert = "insert into visits (FirstName, LastName, Address, Address2, City, Country, Code," _ ********** & "Phone, EMail, Website, Memo, Date, Time)" _ ********** & " values ('" & Request.Form("first") & "','" & Request.Form("last") _ ********** & "','" & Request.Form("address") & "','" & Request.Form("address2") _ ********** & "','" & Request.Form("city") & "','" & Request.Form("country") _ ********** & "','" & Request.Form("code") & "','" & Request.Form("phone") _ ********** & "','" & Request.Form("mail") & "','" & Request.Form("web") _ ********** & "','" & Request.Form("comments")_ ********** & "','" & MySQLDate() & "','" & MySQLTime() & "')" ' Executing the sql insertion code ** ***con.execute sqlInsert ***' Done. Now close the connection ***con.close ***set con = nothing* %> <!--This tells the guest that the information has been received and added to the database--> <table width="500" border="0" cellspacing="0" cellpadding="0"> <h2>Thank you for visiting!</h2> <hr> <p>Your information has been successfully added to our database on <br> <strong><%=FormatDateTime(date,1)%></strong> at <strong><%=time%></strong>.</p> <a href="guestbook.asp">Return to the guest book</a><br> <a href="showdata.asp">View guestbook entries</a> </table> </body> </html> If I could get any extra pointers as to what I could be doing wrong, I would greatly apprecieate it. Thanks Neil Ericson Edmonton, Alberta, Canada |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Invalid character when I try to connect |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|