Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Problem in Opening a Recordset


Message #1 by "Khalid Qureshi" <khalidone@y...> on Sun, 22 Dec 2002 16:41:14
Hello, I am problem in opening a recordset. I want to open a recordset to 
add data in the 
table. I have written following lines of code. 

<%

Dim objConn 
Dim RS1

'Create a connection object
Set objConn=Server.CreateObject ("ADODB.Connection")
'Open the connection
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\Marwah\Shalimar.MDB;Persist Security Info=False"
'Open Recordset
'
Set RS1=Server.CreateObject ("ADODB.Recordset")
RS1.Open "Information", objConn, adOpenStatic, adLockOptimistic, adCmdTable
RS1.AddNew
RS1("Salutation")="Mr"
RS1.Update
%>

The following error I recieve:


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

Please help me out
Message #2 by jonax@t... on Sun, 22 Dec 2002 17:48:23 +0100
Try this:


<%

Dim objConn 
Dim RS1
Dim SQL

SQL =3D "SELECT * FROM Information WHERE 1=3D2"

'Create a connection object
Set objConn=3DServer.CreateObject ("ADODB.Connection")
'Open the connection
objConn.Open "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data 
Source=3DC:\Marwah\Shalimar.MDB;Persist Security Info=3DFalse"
'Open Recordset
'
Set RS1=3DServer.CreateObject ("ADODB.Recordset")
RS1.Open SQL, objConn, 1, 3
RS1.AddNew
RS1("Salutation")=3D"Mr"
RS1.Update
RS1.Close
Set RS1 =3D Nothing
objConn.Close
Set objConn =3D Nothing
%>




  Return to Index