954,598 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

asp connectivity error

<html>
<head>
<title> database ado </title>
</head>

<body>
<%constr = "provider= sqloledb; data source = 6.123.3.183,1234; initial catalog=dbase;User id=scot; password=pwd1"%> 

<%set conpubs= server.createobject("ADODB.Connection")
conpubs.connectionstring= constr
conpubs.open%>

<%Dim rstest
Set rstest = Server.CreateObject("ADODB.Recordset")
rstest.Open "test", constr, adOpenDynamic, adLockOptimistic, adCommandTableDirect
rstest.addnew.fields("name")="three"
rstest.update%>
<%while not rstest.EOF
 
 Response.Write rstest("name") & ""
 rstest.movenext
 
Wend%>

</body>
</html>


the error i get is :
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
line 15..

plz help...
thank's...

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 

somebody please help....have to move forward.. :(

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 
rstest.Open "test", constr, adOpenDynamic, adLockOptimistic, adCommandTableDirect

aashishn86, you cannot use named parameters without first declaring them.

Try

rstest.Open "test", constr, 2, 3, 512


See here for more numeric values.

Alternatively, you can declare the variables first. like so:

DIM adOpenDynamic, adLockOptimistic, adCommandTableDirect
adOpenDynamic = 2
adLockOptimistic = 3
adCommandTableDirect = 512


Then you can use the named arguments in your open stmt.

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

hey thank's..... i tried that too...
but it still gives the same error...

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 
hey thank's..... i tried that too... but it still gives the same error...


I usually just use:

rstest.Open "tablename", constr, 2, 2
agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

Can you please verify the exact line and highlight it? I havn't see the addnew method used like that before, not saying it won't work, but just to make sure.

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

thank's......
i'll do that tomorrow and post back..
no access to the server at the moment...

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 
<% @Language ="VBscript" %>
<html>
<body>

<% 
   DIM adOpenDynamic, adLockOptimistic,    adCommandTableDirect
   adOpenDynamic = 2
   adLockOptimistic = 3
   adCommandTableDirect = 512   

   constr="provider=sqloledb;data source=1.234.5.678,1234;initial catalog = abcd; User Id=abcde; password=abcde"
   
   Set RSObj = Server.CreateObject("ADODB.RecordSet")
   RSObj.Open "test2",constr,2,3,512
   
   RsObj.AddNew.Fields("fname")="aashish"
   RsObj.AddNew.Fields("lname")= "n"
   RsObj.Update
 %>

</html>
</body>

The error i know get is :
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[undefined]'
/aashish/db8.asp, line 16

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 

well, the problem was
i was suppose to write it as

RsObj.AddNew
RsObj.Fields("fname")="aashish"
RsObj.Fields("lname")="n"
RsObj.Update


Thank's agrothe , for all the help...............

aashishn86
Junior Poster
188 posts since Jun 2008
Reputation Points: 10
Solved Threads: 9
 

well, the problem was i was suppose to write it as

RsObj.AddNew
RsObj.Fields("fname")="aashish"
RsObj.Fields("lname")="n"
RsObj.Update

Thank's agrothe , for all the help...............

You're welcome! Your previous use of addnew was suspect to say the least! I'm glad your up and running again.

I would now suggest you start using parametrized queries . The method you are using now is very susceptible to SQL Injection Attacks, which I've experience first hand :) .

The provided link is from 4guysfromrolla website and is an excellent way to update your database (very simple) and provides much greater security.

Cheers.

PS: please mark the thread as solved.

agrothe
Junior Poster
153 posts since Jun 2006
Reputation Points: 37
Solved Threads: 18
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You