VB Code:
Try If Application("Connection") Is Nothing Then Dim mySQLConnStr As String = "Driver={MySQL};" & _ "Server=209.61.188.54;" & _ "Port=3306;" & _ "Option=131072;" & _ "Stmt=;" & _ "Database=wildhorse;" & _ "Uid=script;" & _ "Pwd=php_script;" Dim cn As OdbcConnection = New OdbcConnection(mySQLConnStr) Application("Connection") = cn cn.Open() Dim cmd As New OdbcCommand("SELECT * FROM tblSpecialEvents", cn) Dim ret As Object = cmd.ExecuteScalar() Dim rs As New OdbcDataReader()' error Response.Write(rs.GetValue(0)) If Not IsDBNull(ret) Then Application("Visitors") = CInt(Val(ret)) End If Catch ex As OdbcException Application("Connection") = Nothing Application("ConnectionError") = ex.Message End Try
This says i cant assign rs as new OdbcDatareader becasue its in a private sub...? I dont get it... Also is 'Dim rs As New OdbcDataReader()' that what i should use to get data from a recordset? Or is there something in the command object i should use? Argg i'm so confused..





Reply With Quote