OK, I tried this for my martial arts dropdown menu. We teach karate and kobudo, below is similar code, but added some recordsets, sql strings and the code for the dropdown box. I got an error:
Technical Information (for support personnel)
Error Type:
Provider (0x80020005)
Type mismatch.
/db/addmember.asp, line 33
Browser Type:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Page:
GET /db/addmember.asp
Time:
October 12, 2009, 10:46:47 AM
More information:
Microsoft Support
Here's my code (DB name taken out):
___________________________________________________________
<%
' the connection object
Dim adoConn
' the recordset object
Dim rsGender
Dim rsMA1 '<------ New
' the SQL String
Dim strSQLGender
Dim strSQLMA1 '<------ New
' create the Connection object
Set adoConn = Server.CreateObject("ADODB.Connection")
' open the Connection
adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("databasename.mdb")
' creates the recordset object
Set rsGender = Server.CreateObject("ADODB.Recordset")
' New Recordset
Set rsMA1 = Server.CreateObject("ADODB.Recordset")
' SQL String for query
strSQLGender = "SELECT tblGender.fldGenderID, tblGender.fldGender FROM tblGender;"
'New SQL String
strSQLMA1 = "SELECT tblMArt1.fldMArt1ID, tblMArt1.fldMArt1Name FROM tblMArt1;"
' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
rsGender.Open, strSQLGender, adoConn
rsMA1.Open strSQLMA1, adoConn '<------ New Recordset and SQL string
%> <html>
<head>
<title>Add Member Info</title>
</head>
<body>
<!-- Begin form code -->
<form name="form" method="post" action="addmember.asp">
<table width="500" border="1" align="center">
<tr>
<td colspan="2"><div align="center">MEMBER'S PERSONAL INFO</div></td>
</tr>
<tr>
<td width="250">First Name:</td>
<td width="250">Last Name:</td>
</tr>
<tr>
<td width="250"><input type="text" name="txtFname" id="txtFname"></td>
<td width="250"><input type="text" name="txtLname" id="txtLname"></td>
</tr>
<tr>
<td width="250">D.O.B.:</td>
<td width="250">Gender:</td>
</tr>
<tr>
<td width="250"><input type="text" name="txtDOB" id="txtDOB"></td>
<td width="250">
<SELECT NAME = "GENDER" id = "GENDER">
<%
' while we don't get the end of DataBase
Do While Not rsGender.EOF
'we put the ID at Value
' this value is important to linked tables
%>
<OPTION VALUE="<%=rsGender("fldGenderID")%>"> <%=rsGender("fldGender")%></OPTION>
<%
' Move to the next record...
rsGender.MoveNext
' keep the loop
Loop
%>
</SELECT> </td>
</tr>
<tr>
<td width="250">Address:</td>
<td width="250">City:</td>
</tr>
<tr>
<td width="250"><input type="text" name="txtAddress" id="txtAddress"></td>
<td width="250"><input type="text" name="txtCity" id="txtCity"></td>
</tr>
<tr>
<td width="250">Prov:</td>
<td width="250">Postal Code:</td>
</tr>
<tr>
<td><input type="text" name="txtProv" id="txtProv"></td>
<td><input type="text" name="txtPcode" id="txtPcode"></td>
&nb