Upload submit to Access database

Results 1 to 2 of 2

Thread: Upload submit to Access database

  1. #1
    Chris Horner Guest

    Default Upload submit to Access database

    Using Recordset and Addnew I keep getting a Trapped Error when I try to add a new record to my database and I have followed two books on the subject, ASP for Dummies and ASP 2.0 by WROX and I am none the wiser. Can you help

  2. #2
    Gopal Krishan Guest

    Default RE: Upload submit to Access database

    Hi! you were having problems with Addnew...well i&#039ll give an example to follow..... if you have any question please contact me at renkubabe@hotmail.com<BR><BR><BR>&#060;%@ Language=VBScript %&#062;<BR><BR>&#060;%<BR>Dim conn<BR>Dim rs<BR>Dim strId<BR>Dim strconn<BR><BR>Set conn = Server.CreateObject("Adodb.connection")<BR>strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("students.mdb")<BR>conn.Open strconn<BR>set rs = Server.CreateObject("ADODB.recordset")<BR>&#039Thi s statement opens the table so we can add a record notice the addnew <BR>&#039The 2, 2 is how the table is opened there are many ways it can be opened<BR>rs.open "students", conn, 2, 2<BR>rs.AddNew<BR>rs("FirstName") = request("FirstName")<BR>rs("LastName") = request("LastName")<BR>rs("favoritecolor") = request("favoritecolor")<BR>rs("ID") = request("ID")<BR>rs.Update<BR>rs.MoveLast<BR>strId = rs("ID")<BR>%&#062;<BR>&#060;HTML&#062;<BR>&#060;H EAD&#062;<BR>&#060;META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY&#062;<BR>Your Record # is &#060;%=strId%&#062;<BR>Your First Name is &#060;%=request("FirstName")%&#062;<BR>Your Last Name is &#060;%=request("LastName")%&#062;<BR>Your Favorite Color is &#060;%=request("favoritecolor")%&#062;<BR><BR><BR ><BR>&#060;P&#062;&nbsp;&#060;/P&#062;<BR><BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR>&#060;%<BR>set rs = nothing<BR>set conn = nothing<BR>%&#062;<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
  •