Haveing problems ADDing a record to database

Results 1 to 6 of 6

Thread: Haveing problems ADDing a record to database

  1. #1
    Daven Guest

    Default Haveing problems ADDing a record to database

    I set up a simple database to show date, first name, last name, item and price. I can access the database fine to retrieve the information, but can not add anything to the database. I get this error when I try to access the page.<BR><BR>Error Type:<BR>Microsoft OLE DB Provider for ODBC Drivers (0x80004005)<BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.<BR>/idlelife/test.asp, line 16<BR><BR>This is my current code (I simplified it even more to find the error, but still can&#039t figure it out) Thanks for any help!!<BR><BR>&#060;%@ Language = VBScript %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;!-- #include file = "DatabaseConnection.asp" --&#062; <BR>&#060;!-- #include virtual = "/adovbs.inc" --&#062;<BR>&#060;%<BR> Dim objRS <BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "Projects", objConn, ,adLockOptimistic ,adCmdTable<BR> <BR> objRS.AddNew<BR> objRS("Date") = "05/07/98"<BR> objRS("FirstName") = "Susan"<BR> objRS("LastName") = "Davenport" <BR> objRS("Item") = "Deer"<BR> objRS("AmountDue") = "120.00"<BR> objRS.Update<BR> objRS.MoveFirst<BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR>%&#062;<BR>

  2. #2
    Daven Guest

    Default More Information for anyone who can help

    Here is just some more info on my set up.<BR><BR>Useing Win2K Pro.<BR>I installed the IIS, from the Cd<BR>I&#039m using MS Access 2000 for the database making<BR><BR>Hope this helps in any way.<BR>Again thanks in advance.<BR><BR>PS. I just read a post from last month, stateing that Windows 2000 will not let you add a record to a database. Is this true?? If so, is there any alternitive action?<BR><BR>Daven

  3. #3
    Daven Guest

    Default Read This Instead: New Error

    Ok, I&#039ve been reading all the post I could find on adding records. And found one that said if you can&#039t add a record, make sure you have the read/write feature on. Which the folder which I had the database in was "read-only". So unchecked that and I do not get the "INSERT INTO" error anymore. Now I get a new error and can&#039t figure it out. From what I&#039ve read it should work fine.<BR>This is the code for the update.asp (they enter the info from a form and it goes tot he update.asp page)<BR><BR>Dim objRS<BR>Set objRS = Server.CreateObject("ADODB.connection")<BR> objRS.Open "Projects", objConn, ,adLockOptimistic ,adCmdTable<BR><BR> objRS.AddNew<BR> objRS("Date") = Request.Form("datefinished")<BR> objRS("FirstName") = Request.Form("firstname")<BR> objRS("LastName") = Request.Form("lastname")<BR> objRS("Item") = Request.Form("item")<BR> objRS("AmountDue") = Request.Form("amountdue")<BR> objRS.Update <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR><BR>this is the error i&#039m getting -<BR>Error Type:<BR>Microsoft VBScript runtime (0x800A01C2)<BR>Wrong number of arguments or invalid property assignment: &#039Open&#039<BR>/idlelife/update.asp, line 18<BR><BR>(line 18 is-- objRS.Open "Projects", objConn, ,adLockOptimistic ,adCmdTable)

  4. #4
    Daven Guest

    Default ACK, ok I'm getting the first error again. Ple

    I&#039m now getting the error in my first post again.<BR>I really appreciate the help!!<BR>I&#039ve been trying to firgure this out for the past week, but I am just flustered now.<BR><BR>Daven

  5. #5
    cheese whiz Guest

    Default RE: ACK, ok I'm getting the first error again.

    &#060;snip&#062;<BR>objRS.Open "Projects", objConn, ,adLockOptimistic ,adCmdTable<BR>&#060;/snip&#062;<BR>Try this<BR>objRS.Open "Projects", objConn,adOpenKeySet,adLockOptimistic ,adCmdTable<BR><BR>The default cursor is adOpenForwardOnly, which, according to my ASP book, doesn&#039t allow updates to the DB.<BR>Good Luck!

  6. #6
    Daven Guest

    Default Thank you I'll try that


Posting Permissions

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