Problem passing SQL to Access from Delphi App ?

Problem passing SQL to Access from Delphi App ?

Post by Bit » Fri, 29 Dec 1995 04:00:00



Okay, this *should* be an easy question, wondering if anyone else out there
has the same problem.   I'm porting a Delpi DB app from using our SQL
server at work over to PC-based MS Access 2.0.   I'm having a problem using
INSERT INTO commands - SQL delete and reads work fine with the access DB.
However, when  I try to do a simple INSERT INTO command, I get errors.

(I modeled this small simple application after the help file example in
Access)

procedure Tform1.cmdTestClick(Sender: Tobject);
begin
      InsQuery.Close;
      InsQuery.SQL.ADD('Insert into cable_table (project_name, seq)');
      InsQuery.SQL.ADD('values (');
      InsQuery.SQL.ADD('"tester", "44")');
end;

(the rest of the program is just the Tquery component, DBcomponent, and two
buttons.  Very simple.  The error I get is  "MSACCESS[ODBC] driver error:
"Two parameters were expected, 0 were supplied" Blah, Blah.  The TStrings
field of the Querycomponent is empty.  I know the other settings are
correct, it sees the database fine.  If I use the above Idea with :params
method, then it works.  However, I can't use params in my application
easily (already tried) so I need to discover why this isn't working.  Any
ideas?   I'm leaning toward an outdated or buggy ODBC driver - Borland Tech
support didn't know what was wrong either.   Anyone?

--
N.  Decker



 
 
 

Problem passing SQL to Access from Delphi App ?

Post by Richard Linsley Hoo » Fri, 29 Dec 1995 04:00:00



writes

Quote:

>Okay, this *should* be an easy question, wondering if anyone else out there
>has the same problem.   I'm porting a Delpi DB app from using our SQL
>server at work over to PC-based MS Access 2.0.   I'm having a problem using
>INSERT INTO commands - SQL delete and reads work fine with the access DB.
>However, when  I try to do a simple INSERT INTO command, I get errors.

>(I modeled this small simple application after the help file example in
>Access)

>procedure Tform1.cmdTestClick(Sender: Tobject);
>begin
>      InsQuery.Close;
>      InsQuery.SQL.ADD('Insert into cable_table (project_name, seq)');
>      InsQuery.SQL.ADD('values (');
>      InsQuery.SQL.ADD('"tester", "44")');
>end;

>(the rest of the program is just the Tquery component, DBcomponent, and two
>buttons.  Very simple.  The error I get is  "MSACCESS[ODBC] driver error:
>"Two parameters were expected, 0 were supplied" Blah, Blah.  The TStrings
>field of the Querycomponent is empty.  I know the other settings are
>correct, it sees the database fine.  If I use the above Idea with :params
>method, then it works.  However, I can't use params in my application
>easily (already tried) so I need to discover why this isn't working.  Any
>ideas?   I'm leaning toward an outdated or buggy ODBC driver - Borland Tech
>support didn't know what was wrong either.   Anyone?

begin
      InsQuery.Close;
      InsQuery.SQL.ADD('Insert into cable_table (project_name, seq) ');
                                                                   ^
      InsQuery.SQL.ADD('values (');
      InsQuery.SQL.ADD('"tester", "44")');
end;

Looks like you need a space here as otherwise it reads
'...seq)values...'

--

"Programming is mirroring the world, inside a computer"   Larry O'Brien 1991

Turnpike evaluation. For information, see http://www.turnpike.com/

 
 
 

Problem passing SQL to Access from Delphi App ?

Post by Eric Elfn » Sun, 07 Jan 1996 04:00:00


..snip
Quote:>>Okay, this *should* be an easy question, wondering if anyone else out there
..snip
>>      InsQuery.SQL.ADD('"tester", "44")');

..snip
I've never used Delphi > Access, but in straight Access code the
literal values are delimited by a single quote (') not a double
quote ("), I think...
 
 
 

1. Delphi 1.0 C/S apps hang while accessing MS SQL Server

Hi

I have encountered two problems with Delphi 1.0 C/S apps when talking
to Micrsoft SQL Workstation 6.0:

  1. Trying to post changes to a SQL server view accessed via a TTable
     causes the application to hang while displaying the SQL cursor.
  2. Trying to run an update query on a table previously loaded with
     rows by an insert query also cause the app to hang.
     (Interestingly, using TTable.Batchmove to load the rows, and then
     running the update queries, seems to work).

I haven't noticed any other problems, but the two above are
trememdously limiting.

Has anyone else noticed this behaviour? If so, is there a know fix?

Regards
Andrew

2. ANN : AGS SQL Scribe Documentation Builder & AGS SQL Server Extended Property Editor

3. Access 97 report from Delphi and passing parameters

4. msnews and microsoft server down ??

5. Problem passing an Error from SQL to Access 2000

6. INFORMIX-CLI (16 Bit) Error

7. Delphi 5 and MS Access 97 passing of Strings

8. property with dimension

9. Problem with pass-through SQL in MS Access, Excel

10. Deploying delphi app with MS Access database

11. Accessing Ingres database from delphi app!

12. Deploying Delphi App (accessing MSSQL remotely)

13. Problem with Access app when upgrading to SQL 2000