Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    6
    Member #
    28374
    When using the following connect to link to an Access Database, I get an error.

    Code used is:-

    <%
    DIM objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("proposals.mdb") & ";"
    objConn.Open
    %>
    <%
    DIM objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "Policies", objConn, , adLockOptimistic, adCmdTable

    objRS.AddNew
    objRS("Name") = Request.Form("name")
    objRS("Email") = Request.Form("email")
    objRS("Cover") = Request.Form("cover")
    objRS("Premium") = Request.Form("premium")
    objRS("Startdate") = Request.Form("startdate")
    objRS("Expirydate") = Request.Form("expirydate")
    objRS.Update

    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>
    The error is as follows:

    Error Type:
    ADODB.Recordset (0x800A0BB9)
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

    I've done everything I can to correct the error, any suggestions

  2.  

  3. #2
    Member Eric Mintz's Avatar
    Join Date
    Mar 2012
    Location
    Atlanta, GA
    Posts
    48
    Member #
    31243
    Liked
    7 times
    I can't tell for sure without knowing what the data types the fields are, and knowing what inputs you are testing with when you get the error, but the dates and the currency (is Premium a currency field) look the most suspicious. If you don't supply the dates in a certain format, MSAccess won't interpret it as a date. Don't include the "$" for Premium (if Premium is a currency field) or MSAccess treats it as a string.

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=160

    You're missing the first property after the connection.

    One other thing you'll want to do...and I can't stress this enough...sanitize your input. People will put all sorts of crap into forms that you didn't anticipate, so be sure that your number fields are taking numeric data, your date fields taking dates, etc.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:01 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com