I am using a connection object from code and a DataEnvironment in a VB application

Set CON = New ADODB.Connection
CON.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\AA.MDB;Persist Security Info=False"
CON.Open

Set RS = New ADODB.Recordset

If RS.State = 1 Then RS.Close
RS.ActiveConnection = CON
RS.CursorType = adOpenKeyset
RS.LockType = adLockPessimistic
RS.CursorLocation = adUseClient
RS.Open "Select * from emp"

It gives a error at last line
error :- No value given for one or more required parameters.

Sometimes it gives error
Operation is not allowed when the object is closed.

There is no problem with this piece of code. It is better to close the recordset and connection at the end.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.