ASP Database

access , db Indonesia
  • 13 years ago

    hi guys..i m trying to do a mini registration page which request user to type in their "email" & "name". then it will capture the info and store into the Access Database. My access database name is "MyCustomers" and having a table in it name "tblCustomerInfo" with 4 field "ID", "Email", "Name", "DateEntered". i run from IIS. below are mine 2 asp file code..i dunno where went wrong..pls help..thanks Smiley Face

     

    formpage.asp

    <FORM NAME="YourFormName" METHOD="Post" ACTION="resultspage.asp">
    <TABLE>
    <TR><TD>Email: </TD>
    <TD><INPUT TYPE="text" NAME="Email" SIZE="50"></TD></TR>
    <TR><TD>Name: </TD>
    <TD><INPUT TYPE="text" NAME="Name" SIZE="50"></TD></TR>
    </TABLE>

    <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">
    </FORM>

     

    resultspage.asp

    <%@ Language="VBScript" %>
    <% Option Explicit %>
    <%
    Dim ConnectionString
    ConnectionString = ("DRIVER={Microsoft Access" &_
    "Driver (*.mdb)};DBQ=" &_
    "C:\Inetpub\wwwroot\MyCustomers.mdb;")

    DIM objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "ConnectionString"

    objRS.AddNew
    objRS("Email") = Request.Form("Email")
    objRS("Name") = Request.Form("Name")
    objRS("DateEntered") = Date()
    objRS.Update

    DIM bookmark
    bookmark = objRS.absolutePosition
    objRS.Requery
    objRS.absolutePosition = bookmark

    DIM strCustomerID
    strCustomerID = objRS("ID")
    %>

    <p>Thank you for reigstering with us. Here is your Customer ID: <% =strCustomerID %></p>

    <%
    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>

  • 13 years ago

    hi Intelli_View thanks for the reply, i correct it already..below r mine corrected code..check for me if its correct?? thanksSmiley Face

     

    formpage.asp

    <FORM NAME="YourFormName" METHOD="Post" ACTION="resultspage.asp">
    <TABLE>
    <TR><TD>Email: </TD>
    <TD><INPUT TYPE="text" NAME="Email" SIZE="50"></TD></TR>
    <TR><TD>Name: </TD>
    <TD><INPUT TYPE="text" NAME="Name" SIZE="50"></TD></TR>
    </TABLE>

    <INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">
    </FORM>

     

    resultspage.asp

    <%@ Language="VBScript" %>
    <% Option Explicit %>
    <%
    Dim ConnectMe
    Set ConnectMe=CreateObject("ADODB.Connection")
    ConnectMe.ConnectionString="DRIVER={Microsoft AccessDriver (*.mdb)};DBQ=C:\Inetpub\wwwroot\MyCustomers.mdb"
    ConnectMe.Open

    DIM objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "tblCustomerInfo"

    objRS.AddNew
    objRS("Email") = Request.Form("Email")
    objRS("Name") = Request.Form("Name")
    objRS("DateEntered") = Date()
    objRS.Update

    DIM bookmark
    bookmark = objRS.absolutePosition
    objRS.Requery
    objRS.absolutePosition = bookmark

    DIM strCustomerID
    strCustomerID = objRS("ID")
    %>

    <p>Thank you for reigstering with us. Here is your Customer ID: <% =strCustomerID %></p>

    <%
    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>

  • 13 years ago

    hi Intelli_View..when i run my formpage.asp there is an error tell me that:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    /resultspage.asp, line 7

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic