MS Access and ASP

Results 1 to 2 of 2

Thread: MS Access and ASP

  1. #1
    Join Date
    Dec 1969
    Posts
    4

    Default MS Access and ASP

    I am very new to ASP and therefore I am very stuck as I have come up against a few problems. Please can anyone help.<BR><BR>I am trying first of all to put up a Table from an MS Access Database to the Web but I am coming up with the following error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80004005&#039; <BR><BR>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified <BR><BR>/Events.asp, line 23 <BR><BR><BR>The code I have used is as follows:<BR><BR> &#060;%<BR>Session.timeout = 10<BR>If IsObject(Session("ftp.speeddatinginthecity.com_con n")) Then<BR> Set conn = Session("ftp.speeddatinginthecity.com_conn")<BR>El se<BR> Set conn = Server.CreateObject("ADODB.Connection")<BR> conn.open = I do not know what to put here<BR> Set Session("??ftp.speeddatinginthecity.com_conn") = conn<BR>End If<BR>%&#062;<BR> &#060;%<BR>If IsObject(Session("Events_rs")) Then<BR> Set rs = Session("Events_rs")<BR>Else<BR> sql = "SELECT * FROM [Events]"<BR> Set rs = Server.CreateObject("ADODB.Recordset")<BR> rs.Open sql, conn, 3, 3<BR> If rs.eof Then<BR> rs.AddNew<BR> End If<BR> Set Session("Events_rs") = rs<BR>End If<BR>%&#062;<BR><BR>Another problem I am having is getting a html form to go into an Access Table.<BR><BR>This is the Form I want the results to go into a Table in Access.<BR><BR>&#060;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&#062;<BR>&#060;html&#062;<BR>&#060;head&#062;< BR>&#060;title&#062;Booking Form&#060;/title&#062;<BR>&#060;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body&#062;<BR>&#060;p&#062 ;&#060;img src="Logo.jpg" width="130" height="78"&#062;&#060;/p&#062;<BR>&#060;table width="691" height="560" border="0" align="center" cellpadding="0" cellspacing="0"&#062;<BR> &#060;tr&#062; <BR> &#060;td height="3" style="border-left: 1 solid #000000; border-right: 1 solid #000000" width="691"&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td width="691" height="557" valign="top" align="left"&#062; &#060;form action="http://www.speeddatinginthecity.com/form2mail/form2mail.asp" method="post"&#062; &#060;div align="justify"&#062; <BR> &#060;p&#062;&#060;img src="Booking_Form.jpg" width="146" height="32"&#062;&#060;font face="Arial" size="2"&#062; <BR> &#060;input type="hidden" name="_subject" value="Contact Us Form"&#062;<BR> &#060;input type="hidden" name="_recipient" value="bd@healthy-wellbeing.com"&#062;<BR> &#060;input type="hidden" name="_formmname" value="ContactUs"&#062;<BR> &#060;input type=hidden name="_success" value="http://www.speeddatinginthecity.com"&#062;<BR> &#060;input type="hidden" name="formurl" value="www.speeddatinginthecity.com"&#062;<BR> &#060;font size="3" face="Arial, Helvetica, sans-serif"&#062;<BR><BR> You need to book your ticket before filling in this form so if you have <BR> not done so go to the &quot;Events&quot; page of this website.&#060;/font&#062; <BR> &#060;/font&#062;<BR> &#060;table&#062;<BR> &#060;tbody&#062;<BR> &#060;tr&#062; <BR> &#060;td width="147" height="26" valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Title: <BR> &#060;/font&#062;&#060;/b&#062; &#060;/td&#062;<BR> &#060;td width="159" valign="baseline"&#062; &#060;font face="Arial"&#062; <BR> &#060;select name="os0"&#062;<BR> &#060;option value="Title"&#062;Select Title <BR> &#060;option value="Ms"&#062;Ms <BR> &#060;option value="Miss"&#062;Miss <BR> &#060;option value="Mrs"&#062;Mrs <BR> &#060;option value="Mr"&#062;Mr <BR> &#060;option value="Dr"&#062;Dr <BR> &#060;/select&#062;<BR> &#060;/font&#062;&#060;font size="2" face="Arial"&#062; &nbsp;&#060;/font&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td width="147" valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;First <BR> Name: &#060;/font&#062; &#060;/b&#062; &#060;/td&#062;<BR> &#060;td width="159" valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Name" size=37 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Surname:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=37 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Address:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=37 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;City:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=20 maxlength=20&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Postcode:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=20 maxlength=10&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Telephone:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=20 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font size="2" face="Arial"&#062;Mobile:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=20 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td valign="baseline"&#062;&#060;b&#062;&#060;font size="2" face="Arial"&#062;Email Address:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Surname" size=37 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td width="147" valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062; <BR> Age:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td width="159" valign="baseline"&#062; &#060;font face="Arial" size="2"&#062; <BR> &#060;input name="Age" size=18 maxlength=48&#062;<BR> &#060;/font&#062; &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td height="27" valign="baseline"&#062;&#060;b&#062;&#060;font size="2" face="Arial"&#062;Sex:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062;&#060;font face="Arial"&#062; <BR> &#060;select name="Sex"&#062;<BR> &#060;option value="Choose Sex"&#062;Select One <BR> &#060;option value="Male"&#062;Male <BR> &#060;option value="Female"&#062;Female <BR> &#060;/select&#062;<BR> &#060;/font&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td height="27" valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Marital <BR> Status:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062;&#060;font face="Arial"&#062; <BR> &#060;select name="Marital Status"&#062;<BR> &#060;option value="Select One"&#062;Select One <BR> &#060;option value="Married"&#062;Married <BR> &#060;option value="Single"&#062;Single <BR> &#060;option value="Divorced"&#062;Divorced <BR> &#060;option value="Separated"&#062;Separated <BR> &#060;option value="Widowed"&#062;Widowed <BR> &#060;/select&#062;<BR> &#060;/font&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td height="27" valign="baseline"&#062;&#060;b&#062;&#060;font face="Arial" size="2"&#062;Children:&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062;&#060;font face="Arial"&#062; <BR> &#060;select name="Children"&#062;<BR> &#060;option value="Children"&#062;Select One <BR> &#060;option value="0"&#062;0 <BR> &#060;option value="1"&#062;1 <BR> &#060;option value="2"&#062;2 <BR> &#060;option value="3"&#062;3+ <BR> &#060;/select&#062;<BR> &#060;/font&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;tr&#062; <BR> &#060;td height="27" valign="baseline"&#062;&#060;b&#062;&#060;font size="2" face="Arial"&#062;Where <BR> did you hear about us?&#060;/font&#062;&#060;/b&#062;&#060;/td&#062;<BR> &#060;td valign="baseline"&#062;&#060;font face="Arial"&#062; <BR> &#060;select name="Heard"&#062;<BR> &#060;option value="Heard"&#062;Select One <BR> &#060;option value="Internet"&#062;Internet <BR> &#060;option value="Poster"&#062;Poster <BR> &#060;option value="Flyer"&#062;Flyer <BR> &#060;option value="Friend"&#062;Friend <BR> &#060;option value="Other"&#062;Other <BR> &#060;/select&#062;<BR> &#060;/font&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;/tbody&#062;<BR> &#060;/table&#062;<BR> &#060;font face="Arial" size="2"&#062; <BR> &#060;input type="reset" value="Reset Fields" name="reset"&#062;<BR> &#060;input type="submit" value="Send Form" name="submit"&#062;<BR> &#060;/font&#062; <BR> &#060;/form&#062;<BR> &#060;p&#062;&nbsp;&#060;/p&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;tr&#062;<BR> <BR> &#060;td height="620"&#062;&#060;p align="center"&#062;&#060;a href="Page2.htm"&#062;&#060;img src="Button1.jpg" width="166" height="24" border="0"&#062;&#060;/a&#062;&#060;a href="Page3.htm"&#062;&#060;img src="Button2.jpg" width="166" height="24" border="0"&#062;&#060;/a&#062;&#060;a href="Page4.htm"&#062;&#060;img src="Button3.jpg" width="174" height="24" border="0"&#062;&#060;/a&#062;&#060;img src="Button4.jpg" width="185" height="23"&#062;<BR><BR> &#060;a href="Events.asp"&#062;&#060;img src="Button5.jpg" width="139" height="31" border="0"&#062;&#060;/a&#062;&#060;a href="BookingForm.htm"&#062;&#060;img src="Button6.jpg" width="138" height="31" border="0"&#062;&#060;/a&#062;&#060;a href="FeedbackForm.htm"&#062;&#060;img src="Button7.jpg" width="139" height="31" border="0"&#062;&#060;/a&#062;&#060;a href="TellAFriend.htm"&#062;&#060;img src="Button8.jpg" width="138" height="31" border="0"&#062;&#060;/a&#062;&#060;a href="Job_Opps.htm"&#062;&#060;img src="Button9.jpg" width="135" height="31" border="0"&#062;&#060;/a&#062; <BR> &#060;/p&#062;<BR> &#060;div align="left"&#062; <BR> &#060;table width="42%" border="0"&#062;<BR> &#060;tr&#062; <BR> &#060;td width="35%"&#062;&nbsp;&#060;/td&#062;<BR> &#060;td width="32%"&#062;&#060;a href="Terms_Conditions.htm"&#062;&#060;font color="#808080" size="-3" face="Arial, Helvetica, sans-serif"&#062;&#060;u&#062;Terms <BR> &amp; Conditions&#060;/u&#062;&#060;/font&#062;&#060;/a&#062;&#060;/td&#062;<BR> &#060;td width="33%"&#062;&#060;a href="Privacy-Statement.htm"&#062;&#060;font color="#808080" size="-3" face="Arial, Helvetica, sans-serif"&#062;&#060;u&#062;Privacy <BR> Statement&#060;/u&#062;&#060;/font&#062;&#060;/a&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;/table&#062;<BR> &#060;/div&#062; <BR><BR>Any help would be much appreciated.<BR><BR>Kind regards

  2. #2
    Join Date
    Dec 1969
    Posts
    96,118

    Default Go kill the idiot...

    ...who posted that code you are attempting to copy!<BR><BR>You should NEVER NEVER NEVER store a connection object in a Session variable!<BR><BR>All of this *trash*<BR>[hl="pink"]&#060;%<BR>Session.timeout = 10<BR>If IsObject(Session("ftp.speeddatinginthecity.com_con n")) Then<BR>Set conn = Session("ftp.speeddatinginthecity.com_conn")<BR>El se<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.op en = I do not know what to put here<BR>Set Session("??ftp.speeddatinginthecity.com_conn") = conn<BR>End If<BR>%&#062;<BR>&#060;%<BR>If IsObject(Session("Events_rs")) Then<BR>Set rs = Session("Events_rs")<BR>Else<BR>sql = "SELECT * FROM [Events]"<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>rs.Open sql, conn, 3, 3<BR>If rs.eof Then<BR>rs.AddNew<BR>End If<BR>Set Session("Events_rs") = rs<BR>End If<BR>[/hl]<BR><BR>Should be replaced with *only* this:<BR><BR>&#060;%<BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.op en "...connection string..."<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>rs.Open "Events", conn, 3, 3<BR>...<BR>%&#062;<BR><BR>And what do you use for a connection string? Lots of possibilities. You could create a DSN (use the ODBC Control Panel). You could use a "DSN-less connection". Lots of good ideas here:<BR>http://www.able-consulting.com/ADO_Conn.htm<BR><BR>Probably the OLEDB connection for JET is the best choice for an Access DB.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •