Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ODBC Drivers error '80040e10'


Message #1 by "Joe" <joseph@h...> on Mon, 26 Mar 2001 00:31:34
Thank you if you can help me with my fried brain. The is a example using 

the Northwind data base find a supplier. The script first ask for the 

country and then the city and prints the supplier name. I'm using a 

different database where I would like to pick a state and return a list of 

schools. the original logic is country - city - supplier where I'm useing 

State - school - school I think this is why I get the ODBC Drivers 

error '80040e10' Here is the code... I'm a hacker / programer want to be:



<html>



<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>New Page 5</title>

</head><!-- Dynamic Drop Down. A FrontPageHowTo.com ASP Example -->



<!-- Copy and paste this code into a blank page in FP between the body tags

Import the FpNWind.mdb into your web and set up a database connection 

called Sample to it -->



<!-- Start First Drop Down -->



<%

Set objDC = Server.CreateObject("ADODB.Connection")

objDC.Open Application("Schools_ConnectionString")



Set objRS = objDC.Execute("Select Distinct State FROM Contact_list")

%>





<body>



  <table border="0" cellpadding="0" cellspacing="0" style="border-

collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">

    <tr>

      <td width="11%"> </td>

      <td width="69%">

	<FORM METHOD="POST" NAME="Form1" ACTION="School_SlectST.asp">

	<p align="left">

	<SELECT NAME="State" SIZE="1" ONCHANGE=Form1.submit()>

		<option selected><% = Request.Form("State") %></option>

	<%

	' Continue until we get to the end of the recordset.

	Do Until objRS.EOF

		' For each record we create a option tag and set it's 

value to the countr

		%>

		<OPTION><%= objRS("State") %></OPTION>

		<%

	' Get next record

	objRS.MoveNext

	Loop

	%>

	</SELECT> <b><font face="Arial" size="2" color="#008080">Choose a 

State</font></b></p>

      </FORM>

	<%



' Close Data Access Objects and free DB variables

objRS.Close

Set objRS =  Nothing

objDC.Close

Set objDC = Nothing

%>





<!-- End first Drop Down -->

<!--Second drop down -->



<%

'Some code to hide the second drop down until we make a selection from the 

first

IF Request.Form("State") = "" Then

Else

'If State has a value then we get a list of Schools for the second drop 

down

Set objDC = Server.CreateObject("ADODB.Connection")

objDC.Open Application("Schools_ConnectionString")



Set objRS = objDC.Execute("Select SchoolName FROM Contact_List WHERE State 

= '" & Request.Form("State") & "'")

%>

	<FORM METHOD="POST" NAME="Form2" ACTION="School_SlectST.asp">

	<p align="left">

	<font face="Arial"><font color="#008080"><b>

	<SELECT NAME="SchoolName" SIZE="1" ONCHANGE=Form2.submit()>

		<option><% = Request.Form("SchoolName") %></option>

      <%

	' Continue until we get to the end of the recordset.

	Do Until objRS.EOF

		' For each record we create a option tag and set it's 

value to the SchoolName

		%>

		<OPTION><%= objRS("ScoolName") %></OPTION>

		<%

	' Get next record

	objRS.MoveNext

	Loop

	%>

	<%

	'Set a hidden value in the second form for the Country 

	'so we can pass it along with the State to the next query

	%>

	</SELECT></b></font><b><font size="2" color="#008080">  Choose a 

State</font></b><font size="2" color="#008080"><b></b></font><font 

color="#008080"><b><input type="hidden" name="State" value="<% = 

Request.Form("State") %>"></b></font></font></p>

      </FORM>



<%

' Close Data Access Objects and free DB variables

objRS.Close

Set objRS =  Nothing

objDC.Close

Set objDC = Nothing

End IF

%>



<!-- Display the records -->



      </td>

      <td width="20%"></td>

    </tr>

  </table>

  <table border="0" cellpadding="0" cellspacing="0" style="border-

collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">

    <tr>

      <td width="33%"> </td>

      <td width="47%">

<% 

'Make sure we have submitted a State and don't show results until we do

IF Request.Form("SchoolName") = "" Then

Else

Set objDC = Server.CreateObject("ADODB.Connection")

objDC.Open Application("Schools_ConnectionString")



Set objRS = objDC.Execute("Select * FROM Contact_list WHERE State = '" & 

Request.Form("State") & "' AND SchoolName = '" & Request.Form

("SchoolName") & "'")



'Loop through the database and assign the appropriate values to variables

'that we will use later



Do Until objRS.EOF

SchoolName = objRS("SchoolName")

LastName = objRS("LastName")

Address1 = objRS("Address1")

State = objRS("State")

Zip = objRS("PostalCode")

Phone = objRS("Phone")

Fax = objRS("Fax")

State = objRS("State")

objRS.MoveNext

Loop



objRS.Close

Set objRS = Nothing

objDC.Close

Set objDC = Nothing

%>

<p align="left"><b><font face="Arial" size="2" color="#008080">Our School

Information is: </font><font face="Arial" size="2" color="#800000"> <% 

Response.Write State & ", " & SchoolName %> </font></b>

<br>

<font face="Arial" size="1" color="#008080">

<%

Set up the display of the record

Response.Write SchoolName & "<br>"

Response.Write LastName & "<br>"

Response.Write Address1 & "<br>"

Response.Write State & ", " & " " & Zip & "<br>"

Response.Write "Phone: " & Phone1 & "<br>"

IF Fax1 <> "" Then

Response.Write "Fax: " & Fax1 & "<br>"

End IF

End IF

%> 



</font>

</p>



      </td>

      <td width="20%"> </td>

    </tr>

  </table>





</body>





</html>







Thanks if you can help!


  Return to Index