|
-
Oct 7th, 2000, 04:55 PM
#1
Thread Starter
Hyperactive Member
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>
-
Oct 7th, 2000, 04:58 PM
#2
Monday Morning Lunatic
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
-
Oct 7th, 2000, 05:20 PM
#3
Thread Starter
Hyperactive Member
Ya, They look right and I even tried to change the first two and got the same error. The last two are definitly right.
-
Oct 7th, 2000, 05:36 PM
#4
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
%>
-
Oct 8th, 2000, 12:07 AM
#5
Frenzied Member
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..
-
Oct 9th, 2000, 10:33 AM
#6
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|