Dogday
Dogday

Reputation: 175

classic asp database connection issue

I have inherited some code and need help on how to access a database that some asp.net code is using:

set oconn_mtk = server.createobject("ADODB.Connection")
oconn_mtk.CursorLocation = 3
oconn_mtk.mode = 3
oconn_mtk.Open "database_name"

Does this make sense to anyone? How would I access the data of this database?

Many thanks for all your help!

Upvotes: 0

Views: 106

Answers (1)

Jason
Jason

Reputation: 3030

This doesn't appear to be ASP.NEXT (the new upcoming .NET fun), but instead it looks more like classic ASP.

SQL = "SELECT * FROM TABLE_NAME"
Set oconn_mtk = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open SQL,Connection
If rs.EOF Then 
    Response.Write("No records returned.") 
Else 
    'if there are records then loop through the fields 
    Do While NOT rs.Eof   
      Response.write rs("FIRST_FIELD_NAME")
      Response.write rs("SECOND_FIELD_NAME")
      Response.write rs("THIRD_FIELD_NAME")
      Response.write "<br>"    
    rs.MoveNext     
   Loop
End If
rs.close : oconn_mtk.close

Upvotes: 1

Related Questions