【发布时间】:2010-04-09 22:13:21
【问题描述】:
我有这个连接到我的服务器的 mySQL 代码。它连接得很好:
Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=example.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()
但是,我有一个旧的 Classic ASP 页面,它使用“oRecordset”从 mySQL 服务器获取数据:
Set oConnection = Server.CreateObject("ADODB.Connection")
Set oRecordset = Server.CreateObject("ADODB.Recordset")
oConnection.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=example.com; PORT=3306; DATABASE=xxx; USER=xxx; PASSWORD=xxx; OPTION=3;"
sqltemp = "select * from userinfo WHERE emailAddress = '" & theUN & "'"
oRecordset.Open sqltemp, oConnection,3,3
我可以按如下方式使用 oRecordset:
if oRecordset.EOF then....
或
strValue = oRecordset("Table_Name").value
或
oRecordset("Table_Name").value = "New Value"
oRecordset.update
等等……
但是,就我的一生而言,我找不到任何与我的经典 ASP 页面相似的 .net 代码!!!!!
任何帮助都会很棒! :o)
大卫
【问题讨论】: