Jump to content

connecting mysql, asp


cyrus71
 Share

Recommended Posts

hi everybodyI am trying to connect mysql server (mysql 4.1) from asp using odbc (odbc 3.51) connection strings.when i insert data to my database so it goes well i used following code:set Conn = Server.CreateObject("ADODB.Connection")Conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=kurf;USER=root;PASSWORD=rishakawwemana;Option=3;"sql="INSERT INTO diwan (fornamn,efternamn,"sql=sql & "nicknamn,password)"sql=sql & " VALUES "sql=sql & "('" & fnamn & "',"sql=sql & "'" & enamn & "',"sql=sql & "'" & nnamn & "',"sql=sql & "'" & pword & "')"on error resume nextconn.Execute sql,raknareif err<>0 then Response.Write("No update permissions!")else Response.Write("<h3>" & raknare & " record added</h3>")end ifconn.close-------------------------------------------------------------------------------------------but my problem shows up when i want to display my data by using Recordset.it is my code: set Conn = Server.CreateObject("ADODB.Connection")Conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=kurf;USER=root;PASSWORD=rishakawwemana;Option=3;"set rs=Server.CreateObject("ADODB.Recordset")rs.Open "Select * from diwan" , Conndo until rs.EOF for each x in rs.Fields Response.Write(x.name) Response.Write("=") Response.Write(x.value & "<br />") next Response.Write("<br />") loop rs.close Conn.closeand i was geting following error message.Error Type:Active Server Pages, ASP 0113 (0x80004005)The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools./databas/add2.aspThanks to all

Link to comment
Share on other sites

Try this: set Conn = Server.CreateObject("ADODB.Connection")Conn.Open "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=kurf;USER=root;PASSWORD=rishakawwemana;Option=3;"set rs=Server.CreateObject("ADODB.Recordset")rs.Open "Select * from diwan" , Conndo until rs.EOF for each x in rs.Fields Response.Write(x.name) Response.Write("=") Response.Write(x.value & "<br />") next Response.Write("<br />") rs.MoveNext loop rs.close Conn.closeIT looks like you forgot the rs.MoveNext part. But im not sure.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...