oRecordset in ASP.NET mySQL problem

Posted by StealthRT on Stack Overflow See other posts from Stack Overflow or by StealthRT
Published on 2010-04-09T22:13:21Z Indexed on 2010/04/09 23:43 UTC
Read the original article Hit count: 454

Filed under:
|
|
|

I have this mySQL code that connects to my server. It connects just fine:

 Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
 "SERVER=xxx.com;" & _
 "DATABASE=xxx;" & _
 "UID=xxx;" & _
 "PASSWORD=xxx;" & _
 "OPTION=3;"

 Dim conn As OdbcConnection = New OdbcConnection(MyConString)
 conn.Open()

 Dim MyCommand As New OdbcCommand
 MyCommand.Connection = conn
 MyCommand.CommandText = "select * from userinfo WHERE emailAddress = '" & theUN & "'""
 MyCommand.ExecuteNonQuery()
 conn.Close()

However, i have an old Classic ASP page that uses "oRecordset" to get the data from the mySQL server:

 Set oConnection = Server.CreateObject("ADODB.Connection")
 Set oRecordset = Server.CreateObject("ADODB.Recordset")

 oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=xxx.com; PORT=3306; DATABASE=xxx; USER=xxx; PASSWORD=xxx; OPTION=3;"
 sqltemp = "select * from userinfo WHERE emailAddress = '" & theUN & "'"
 oRecordset.Open sqltemp, oConnection,3,3

And i can use oRecordset as follows:

 if oRecordset.EOF then....

or

 strValue = oRecordset("Table_Name").value

or

 oRecordset("Table_Name").value = "New Value"
 oRecordset.update

etc...

However, for the life of me, i can not find any .net code that is simular to that of my Classic ASP page!!!!!

Any help would be great! :o)

David

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mysql