ADO AddNew.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ADO AddNew.

  1. #1
    Gerry Guest

    ADO AddNew.


    Hi,

    I am currently connecting to MS Access database and All I want to do is able
    to add new record into the current table "Personal". Everytimes, I ran the
    program and click on the add button I got the following message.

    Run-time Error '-2147217900 (80040e14)'
    Invalid SQL SELECT statement; Expect 'DELETE','INSERT','PROCEDURE','SELECT'
    or 'UPDATE'

    Here is my source code

    Set AdoRS1 = New ADODB.Recordset
    AdoRS1.CursorLocation = adUseServer
    AdoRS1.CursorType = adOpenKeyset
    AdoRS1.LockType = adLockOptimistic

    > AdoRS1.Open "Personal", adoCN1, , , adCmdText


    And the program stop at the line above. Could someone tell me how to solve
    this problem. Thanks in Advance.



  2. #2
    Kevin MacCallum Guest

    Re: ADO AddNew.


    YOu need to change the last parameter of the open statement.
    adCmdText indicates the 1st parameter is a SQL statement:
    "select * from Personal" would work there.

    I think you want it to be adCmdTable or adTable (not at my development machine)

    As it stands now it is trying to interpret Personal as a SQL statement.

    Try:
    AdoRS1.Open "Personal", adoCN1, , , adCmdTable
    or
    AdoRS1.Open "select * from Personal", adoCN1, , , adCmdText


    Kevin

    "Gerry" <xvoyager@hotmail.com> wrote:
    >
    >Hi,
    >
    >I am currently connecting to MS Access database and All I want to do is

    able
    >to add new record into the current table "Personal". Everytimes, I ran

    the
    >program and click on the add button I got the following message.
    >
    >Run-time Error '-2147217900 (80040e14)'
    >Invalid SQL SELECT statement; Expect 'DELETE','INSERT','PROCEDURE','SELECT'
    >or 'UPDATE'
    >
    >Here is my source code
    >
    > Set AdoRS1 = New ADODB.Recordset
    > AdoRS1.CursorLocation = adUseServer
    > AdoRS1.CursorType = adOpenKeyset
    > AdoRS1.LockType = adLockOptimistic
    >
    >> AdoRS1.Open "Personal", adoCN1, , , adCmdText

    >
    >And the program stop at the line above. Could someone tell me how to solve
    >this problem. Thanks in Advance.
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center