View Single Post
  #3 (permalink)  
Old 08-11-03, 12:06 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
This should work...

Replace "column_name" with the column name you want to get information from. Replace "table_name" with your table name. Replace "another_column" with the name of the column that has the known value.

This code works well if you only want to get one record/result. If you want bring back multiple records, you will have to create a loop.
Code:
Dim sql, value
' Define a connection object
Set conn = Server.CreateObject("ADODB.Connection")
' open the connection
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb") & ";" 

sql = "select column_name from table_name where another_column='something'"



Set RS = conn.Execute(sql)

If NOT RS.EOF Then
value = RS("column_name")
Else
value = "Record not found"
End If

RS.Close
Set RS = Nothing
conn.Close
Set conn = nothing

Response.Write(value)
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote