-
I have a simple form setup that I need to write to a database. Once written I need it to redirect the person to a 2nd page which shows a list of what's in the Database. I am new to databases and could use any help.
Thanks
Please reply even if it's only to help me write to the database when hitting submit. thanks.
-
I got that fixed with a little help, but I'm still having a small problem. How would I say to list everything in Fields 1,3, and 6 in a table.
Thanks for any help.
Here is what I have so far, it just shows every field, which is too much.
Code:
<%
Dim cnn
Dim rst
Dim connectString
set cnn = Server.CreateObject ("ADODB.Connection")
set rst = Server.CreateObject ("ADODB.Recordset")
ConnectString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\shared webs\art\new1\mdb\speed.mdb"
cnn.open connectString
rst.open "speed", cnn, 2, 2
%>
<Table Border="1" width="100%">
<tr bgcolor="#C0C0C0">
<%
if rst.EOF AND rst.BOF then
Response.Write ( "No Records found")
else
'output field names
For intFieldCounter = 0 To (rst.Fields.Count) - 1
Response.Write( "<TH>" & rst.Fields.Item(intFieldCounter).Name )
Next
Response.Write ( "</TR>" )
'output records
Do Until rst.EOF
Response.Write( "<TR>" )
for intFieldCounter = 0 to (rst.Fields.Count) - 1
if rst.Fields.Item(intFieldCounter).Name = "DonorID" then
Response.Write( "<TD> <A HREF=http://" & strServerName & "/dacm/content/donorTests.asp?DonorID=" & rst(intFieldCounter) & ">" & rst(intFieldCounter) & " </a> </TD>" )
else
Response.Write( "<TD>" & rst(intFieldCounter) & "</TD>" )
end if
Next
rst.MoveNext
Response.Write( "</TR>" )
Loop
Response.Write( "</Table>" )
rst.Close
cnn.Close
set cnn = Nothing
End if
%>
-
You could pass in an SQL statement to do that.
Something like:
SQL = "SELECT Field1,Field3,Field6 FROM MyDB"
rst.open SQL, cnn, 2, 2
This would create a recordset with those particular fields where 'Field1 etc.' is your column names and and 'MyDB' is the name of your DB.