DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
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.
    >
    >



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links