Adding records to Database

Results 1 to 4 of 4

Thread: Adding records to Database

  1. #1
    Join Date
    Dec 1969
    Posts
    99

    Default Adding records to Database

    Hi.<BR>I am trying to add records to a database.<BR>However, every time I try, I receive the same error:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Can&#039t update. Database or object is read-only. <BR><BR>Can you tell me how to avoid this? Here is my code:<BR><BR>&#060;%<BR><BR>Set ConnObj=Server.CreateObject("ADODB.Connection")<BR >Set RSObj=Server.CreateObject("ADODB.Recordset")<BR>RS Obj.Open "eventsCalendar","DBQ=j:wwwtesthtmlpartnerseventse vents.mdb;DRIVER=Microsoft Access Driver (*.mdb)",1,2,2<BR><BR>RSObj.AddNew<BR>RSObj("event sDate")=Request.Form("date")<BR>RSObj("eventsName" )=Request.Form("name")<BR>RSObj("eventsLocation")= Request.Form("list")<BR>RSObj("eventsSponsor")=Req uest.Form("dept")<BR>RSObj("eventsContact")=Reques t.Form("contact")<BR>RSObj("eventsContactEmail")=R equest.Form("email")<BR>RSObj("eventsDetail")=Requ est.Form("part")<BR>RSObj.Update<BR><BR>&#037;&#06 2;<BR><BR>Thanks in advance.<BR><BR>Jill<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    69

    Default RE: Adding records to Database

    Try with:<BR><BR>RSObj.Open "eventsCalendar","DBQ=j:wwwtesthtmlpartnerseventse vents.mdb;DRIVER=Microsoft Access Driver (*.mdb)",3,3,1<BR><BR>Study object methodes and properties for Connection, Command and Recordset Object. If you have Visual Studio you can find it in MSDN Librery.<BR><BR>Also note that using update is the slowest way to write a record into database! For more info see and article in www.asptoday.com called "Benchamrking Database Update" or something like it.

  3. #3
    Join Date
    Dec 1969
    Posts
    99

    Default RE: Adding records to Database

    I tried that, and then I received the following error. I know the first number is the cursor type, the second is lock type, and the third is command type. But what do each of the numbers mean, and/or where can I find what they signify?<BR>Thanks again.<BR><BR>Jill<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Invalid SQL statement; expected &#039DELETE&#039, &#039INSERT&#039, &#039PROCEDURE&#039, &#039SELECT&#039, or &#039UPDATE&#039. <BR><BR>/partners/events/addevent.asp, line 9 <BR>

  4. #4
    Join Date
    Dec 1969
    Posts
    69

    Default RE: Adding records to Database

    Ok sorry, You are missing SQL Statemet upfront. E-mail me and I will prepare you an example how it suppose to look like.<BR><BR>Those numbers in the statemnts are "constants" reflecting methodes for Objects I mentioned before. No problems, I can copy you with info from MSDN regarding those Objects.<BR><BR>Short info:<BR><BR>3,3 as I said stands for:<BR><BR>Recordset.CursorType = adOpenDynamic<BR>Recordset.LockType = adLockOptimistic<BR><BR>You wouldn&#039t be very wrong to use always 3, 3 (because you can read Recordset with 1, 1 but you cannot write into it). Of course, for securuty reason, once you open Recordset for Reading only it is better to use 1, 1 (or something like that!). More info on my e-mail: stevang@mail.com


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •