M
middletree
Trying to build a dropdown from the values in an Access database, but can't
get past this error. Should be easy, but I can't make it work.
First, the code:
1. <select name="Gift1" id="Gift1">
<option value="" selected>-Select One-
<%Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT GiftID, GiftDesc "
strSQL = strSQL & "FROM Gift "
strSQL = strSQL & "ORDER BY GiftDesc"
RS.Open strSQL, conn
' set rs = objconnection.execute(strSQL)
While Not RS.EOF
Response.Write "<option
value='"&RS.Fields("GiftID")&"'>"&RS.Fields("GiftDesc")&"</option>"
RS.MoveNext
WEND
RS.Close
set RS = nothing
%>
</select>
Then, the code in my include file to establish connection:
cst = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cst = cst & server.mappath("shape.mdb")
set conn = Server.CreateObject("ADODB.Connection")
conn.open cst
The page already has successfuly connected to insert some data, so I don't
think the connection code is bad. What am I doing wrong?
get past this error. Should be easy, but I can't make it work.
First, the code:
1. <select name="Gift1" id="Gift1">
<option value="" selected>-Select One-
<%Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT GiftID, GiftDesc "
strSQL = strSQL & "FROM Gift "
strSQL = strSQL & "ORDER BY GiftDesc"
RS.Open strSQL, conn
' set rs = objconnection.execute(strSQL)
While Not RS.EOF
Response.Write "<option
value='"&RS.Fields("GiftID")&"'>"&RS.Fields("GiftDesc")&"</option>"
RS.MoveNext
WEND
RS.Close
set RS = nothing
%>
</select>
Then, the code in my include file to establish connection:
cst = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
cst = cst & server.mappath("shape.mdb")
set conn = Server.CreateObject("ADODB.Connection")
conn.open cst
The page already has successfuly connected to insert some data, so I don't
think the connection code is bad. What am I doing wrong?