Howdy all, very much a novice ASP programmer. I'm working with an Access 2000 database, and I somehow managed to create one page that uses ASP to loop through all of the records in one table and displays a schedule - success!
Next, I need to understand how to select only one row from a table and draw an entire page based on fields related to that one row. Ultimately, I anticipate feeding that value (ie which row to use) from a separate page. So, for example, I would tell the page the "primary key" for the row I want to display, and it would give me a bunch of data back related to that row.
But, despite doing some heavy reading, I can't seem to figure out how to select just one row from the table.
I know this is a newbie question, I would be most appreciative if someone could even point me in the direction of a tutorial or something that covers this topic.
This is the code I'm using in the page that works:
---
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
Dim strDatabaseType
strDatabaseType = "Access"
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db.mdb;" & _
"Persist Security Info = False"
objRS.Open "qrySelectAllGameInfo", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
Followed by your typical:
While Not objRS.EOF
~lots of stuff~
Wend
---------
Any help would be greatly appreciated!
Steve
Next, I need to understand how to select only one row from a table and draw an entire page based on fields related to that one row. Ultimately, I anticipate feeding that value (ie which row to use) from a separate page. So, for example, I would tell the page the "primary key" for the row I want to display, and it would give me a bunch of data back related to that row.
But, despite doing some heavy reading, I can't seem to figure out how to select just one row from the table.
I know this is a newbie question, I would be most appreciative if someone could even point me in the direction of a tutorial or something that covers this topic.
This is the code I'm using in the page that works:
---
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection"
Set objRS = Server.CreateObject("ADODB.Recordset"
Dim strDatabaseType
strDatabaseType = "Access"
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\db.mdb;" & _
"Persist Security Info = False"
objRS.Open "qrySelectAllGameInfo", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
Followed by your typical:
While Not objRS.EOF
~lots of stuff~
Wend
---------
Any help would be greatly appreciated!
Steve