Results 1 to 6 of 6

Thread: Can't make it do the simplest thing!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    I found this code in a "ASP FOR DUMMIES" Book. They saw me coming when they made the title. Can anyone help me out here?
    I'm trying to use this code to update the database but keep getting this era:
    "The application is using arguments that are of the
    wrong type, are out of acceptable range, or are in conflict with one another.
    filename.asp line 13"

    <html>
    <head>
    <title>
    </title>
    </Head>
    <body>
    <%
    Dim Connect,rs, Query
    Set Connect = Server.CreateObject("ADODB.Connection")
    Connect.Open "NewSite" 'my DSN
    set rs = server.CreateObject ("ADODB.Recordset")
    Query = "SELECT Tracking.* FROM Tracking;" 'the table name
    rs.Open Query,Connect,adOpenStatic,adLockOptimistic
    rs.AddNew
    'ISSUENUM" is the column name string" is a string
    rs("ISSUENUM1") = "string"
    rs.Update
    %>
    </body>
    </html>

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Are your parameters for rs.Open in the right order?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Ya, They look right and I even tried to change the first two and got the same error. The last two are definitly right.

  4. #4
    Guest
    Remember VBScript has no idea what the values of enums are:
    Code:
    <%
    
    'values used for enums supplied by ADO, found in adovbs.inc
    
    '---- CursorTypeEnum Values ----
    Const adOpenForwardOnly = 0
    Const adOpenKeyset = 1
    Const adOpenDynamic = 2
    Const adOpenStatic = 3
    
    '---- LockTypeEnum Values ----
    Const adLockReadOnly = 1
    Const adLockPessimistic = 2
    Const adLockOptimistic = 3
    Const adLockBatchOptimistic = 4
    
    Dim rec, con, sql, sConnString
    
    
    set con = Server.CreateObject ("ADODB.Connection")
    con.open "YourDSNGoesHERE"
    
    set rec = Server.CreateObject ("ADODB.Recordset")
    
    'the following query will always return an empty recordset
    'but one that allows the addnew method to affect the tracking table 
    sql = "select tracking.* from tracking where 0=1"
    
    rec.Open sql,con,adOpenKeyset , adLockOptimistic 
    rec.AddNew 
    rec("IssueNum") = "Testing!"
    rec.Update 
    rec.Close 
    set rec = nothing
    con.Close 
    set con = nothing
    %>

  5. #5
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Just add this to your Global.asa document:

    <!-- METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library"
    TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}" -->


    All of the ADO constants will be available throughout your web app.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Thanks Guys,
    Your the best!

Posting Permissions

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



Click Here to Expand Forum to Full Width