Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.AddNew is failing

Status
Not open for further replies.

debbierich22

Programmer
Sep 25, 2001
13
0
0
US
I've an ASP beginner and I am having trouble handling recordsets.

Here's a generic sample of my code:

Code:
DBConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
Set cnnSimple = Server.CreateObject("ADODB.Connection")
cnnSimple.Open DBConnect

Set objRecordset = Server.CreateObject("ADODB.Recordset")
objRecordset.Source           = "User_Info"
objRecordset.ActiveConnection = DBConnect
objRecordset.CursorType       = adOpenKeyset
objRecordset.Open

objRecordset.AddNew
objRecordset.Fields("FirstName") = fvar
objRecordset.Fields("LastName") = lvar
objRecordset.Fields("EMailAddress") = evar
objRecordset.Fields("UserName") = uvar
objRecordset.Fields("Password") = pvar
objRecordset.Update

objRecordset.Close
Set objRecordset = Nothing

This is the error that I receive:

ADODB.Recordset (0x800A0CB3)
Object or provider is not capable of performing requested operation.

What is wrong?
 
Try displaying the CursorType after the Open or
If not objRs1.Supports(adAddNew) then
.....
End if
"Remarks
Use the CursorType property to specify the type of cursor that should be used when opening the Recordset object.

Only a setting of adOpenStatic is supported if the CursorLocation property is set to adUseClient. If an unsupported value is set, then no error will result; the closest supported CursorType will be used instead.

If a provider does not support the requested cursor type, it may return another cursor type. The CursorType property will change to match the actual cursor type in use when the Recordset object is open. To verify specific functionality of the returned cursor, use the Supports method. After you close the Recordset, the CursorType property reverts to its original setting." Compare Code (Text)
Generate Sort in VB or VBScript
 
Does the error message give a line number where the error occurred?

Have you included the ADOvbs file?
<!-- #include file=&quot;ADOvbs.inc&quot; -->

or assigned a value to adOpenKeyset
Code:
Dim adOpenKeyset
adOpenKeyset = 1
 
Thanks for the help. I tried the &quot;If&quot; statement first. Supports.AddNew returns true. So then I tried displaying the cursor type.

To display the cursor type I used:

Code:
Response.Write(objRecordset.CursorType)

The output is 0. What does that mean?
 
Thanks. I just included the file (The file name was spelled wrong before). Now, Supports(adAddNew) returns false. Where do I go from here?
 
Furst of all, it looks like you do not have Option Explicit specified so that mispelled variables will give an error. Put one in there.
<%@ LANGUAGE=VBScript EnableSessionState=False %>
<% Option Explicit %>
Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top