Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2005, 12:05 AM
Registered User
 
Join Date: Jan 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default unable to post info into access.

Hi I need a bit of help . i'm trying to post info into a access db from a form . but is not working here is the code.
(dbCREATED= "LEADS" tables= "SELLER".)

SELLERLEAD2.ASP
<html>
<head>
<link href="CSS/forms.css" rel="stylesheet" type="text/css">
</head>

<body>

<p>Seller Questionnaire page</p>


<form name="form" action="addtodb.asp" method="post">
  <table border="0" align="center">
    <tr>
      <td><table width="100%" border="0" class="maintable">
          <tr class="tableheader">
            <td colspan="4"><strong>Contact Infomation </strong></td>
          </tr>
          <tr>
            <td width="20%"><span class="asterisk">*</span>First Name </td>
            <td width="21%"><input name="FirstName" type="text" class="Require" id="FirstName"></td>
            <td width="15%"><span class="asterisk">*</span>Day Phone </td>
            <td><input name="Dayphone" type="text" class="Require" id="Dayphone"></td>
          </tr>
          <tr>
            <td><span class="asterisk">*</span>Last Name </td>
            <td><input name="LastName" type="text" class="Require" id="LastName"></td>
            <td><span class="asterisk">*</span>Evening Phone </td>
            <td><input name="Eveningphone" type="text" class="Require" id="Eveningphone"></td>
          </tr>
          <tr>
            <td><span class="asterisk">*</span>Email</td>
            <td><input name="Email" type="text" class="Require" id="Email"></td>
            <td>Cell Phone </td>
            <td><input name="Cellphone" type="text" class="Require" id="Cellphone"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td><span class="asterisk">*</span>Best time to call? </td>
            <td><select name="BTC" class="Require" id="BTC">
                <option value="0" selected>-Select One-</option>
                <option value="Anytime">Anytime</option>
                <option value="Morning">Morning</option>
                <option value="Afternoon">Afternoon</option>
                <option value="Evening">Evening</option>
                <option value="Night">Night</option>
            </select></td>
          </tr>
      </table> <table width="100%" border="0" class="maintable">
          <tr class="tableheader">
            <td colspan="2"><strong>The Situation </strong></td>
          </tr>
          <tr>
            <td width="32%"><span class="asterisk">*</span>Do you need to sell your house fast? </td>
            <td width="68%"><input name="Sell_fast" type="radio" value="Yes">
            Yes
              <input name="Sell_fast" type="radio" value="No">
            No</td>
          </tr>
          <tr>
            <td colspan="2"><input name="Submit" type="submit" class="submit" value="Submit Now"></td>
          </tr>
        </table> </td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
</body>
</html>

then here is my addtodb.asp page
<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'declare your variables
Dim First Name, Last Name,Email, Day phone, Evening phone, BTC, Sellfast
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
First Name = Request.Form("FirstName")
Last Name = Request.Form("LastName")
Email = Request.Form("Email")
Day phone = Request.Form("Dayphone")
Evening phone = Request.Form("Eveningphone")
BTC = Request.Form("BTC")
Sellfast = Request.Form("Sell_fast")

'declare SQL statement that will query the database
sSQL = "INSERT into SELLER (First Name, Last Name, Email, Day phone, Evening phone, BTC,Sellfast) values ('" &FirstName & "', '" & LastName & "', '" & Email & "','"& Dayphone & "', '" & Eveningphone & "','" & BTC & "','" & Sell_fast & "')"

'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("/LEADS.mdb")


'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

response.write "The form information was inserted successfully."

' Done. Close the connection object
connection.Close
Set connection = Nothing
%>
</body>
</html>

please feel free to email me or rewrite the code or anything. thanks.




Give a fish to the man and he will eat for a day;Teach him how to fish and he will eat for life.
 
Old February 24th, 2005, 03:39 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is the error shown now?

Shibu Narayanan
Software Associates
 
Old February 24th, 2005, 07:50 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
is theirany errors or you can't insert you record?
what is the problem in your code? tell me the error.

surendran
(Anything is Possible)
 
Old February 24th, 2005, 02:22 PM
Authorized User
 
Join Date: Dec 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to shankhan Send a message via Yahoo to shankhan
Default

Instead of writing the whole code if u just write the SQL statement with the error. I think i'll help alot to understand.

Shan Khan
Multan






Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting info from Internet Explorer into Access AstridVM Access VBA 2 November 2nd, 2007 09:15 AM
Update info from Access Wall st Guru Excel VBA 0 February 27th, 2006 09:46 AM
INSERT info into a Access database for display sideshow245 Classic ASP Databases 2 January 7th, 2004 04:25 PM
info from pg won't post to db scottiegirl PHP Databases 3 September 26th, 2003 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.