-
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.
-
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
Forum Rules
|
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
|
Bookmarks