Solved

AODB.Recordset -> objRS.AddNew problem

Posted on 2000-03-24
3
405 Views
Last Modified: 2012-08-14
Here's my cute little test.asp file:

<!-- #include file="includes/adovbs.inc" -->

<%
 
      Set rs = Server.CreateObject("ADODB.Recordset")

      strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/imc/database/herbalife.mdb")
      rs.Open "test", strDSN, adOpenStatic ',adLockBatchOptimistic
      rs.AddNew
        rs("test") = "yapp: " & Now
      rs.UpdateBatch
      rs.Close
      Set rs = Nothing

%>


And here is the error I allways get:

ERROR :

ADODB.Recordset error 800a0cb3

The operation requested by the application is not supported by the provider.

/learning/ecm/test.asp, line 10

---------

what on earth am I doing wrong?

I just want to be able to add a new record via the .addnew metode..

"HEEELP!"

thanks in advance,
NiTech
0
Comment
Question by:NiTech
3 Comments
 
LVL 4

Accepted Solution

by:
FRehman earned 50 total points
Comment Utility
dont use updatrebatch method use update method for saving the record i think you not familar with vb dont worry i correct the code

set Myconn=server.CreateObject("ADODB.connection")
Myconn.Open "DRIVER={MicroSoft Access Driver (*.mdb)};DBQ=" & server.MapPath("./website.mdb")
set rs=server.CreateObject("ADODB.recordset")
rs.open "Select * from Login " ,Myconn ,adOpenDynamic,adLockOptimistic
rs.AddNew
rs.Fields("usrName")=loginName
rs.Fields("pwd")=pwd
rs.Update
rs.close
0
 
LVL 1

Expert Comment

by:bennyliaw
Comment Utility
Do you really need apostrof ' in the line below?!

rs.Open "test", strDSN, adOpenStatic ',adLockBatchOptimistic

I think it makes the server use default value that is adLockReadOnly which will not allow you to modify the recordset.

Try using adLockBatchOptimistic or adLockOptimistic instead
0
 

Author Comment

by:NiTech
Comment Utility
That's mighty good.
And, mmm I am familiar with vb, I was just very confused by different explainations. So instead of getting further confused I choose to find a correct answer - Now()

Thanks in advance
Nit-
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now