Solved

Executing Querys in code

Posted on 2014-02-11
3
322 Views
Last Modified: 2014-02-11
IBDatabase1.Open;
  IBQuery1.Database := IBDatabase1;
  IBQuery1.SQL.Clear;

   //All the examples show
  //  Insert into employee(Field1, Field2) Values('1','Price')
  // Problem is that the entire string has to be in single quotes

  //None of these work
  IBQuery1.SQL.Add('Insert into Employee(PersonID, LastName) Values(1, Price)');
  IBQuery1.SQL.Add('Insert into Employee(PersonID, LastName) Values(1, "Price")');
 
  IBQuery1.Transaction.StartTransaction;
  IBQuery1.ExecSQL;

   // This generates the error - 'Dynamic SQL Error SQL Error Code = -206
   // column unknown
   // PRICE
 
 
  IBQuery1.Transaction.Commit;
  IBDatabase1.Close;
0
Comment
Question by:CiaoBaby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39851858
You used " instead of two single quotes for each inline single quote:
IBQuery1.SQL.Add('Insert into Employee(PersonID, LastName) Values(1, ''Price'')');

Open in new window

0
 

Author Closing Comment

by:CiaoBaby
ID: 39851871
Thanks, for the fast and perfect response.  Is there some place I can find all the little gotcha's in SQL?
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 39851884
Sorry, no. This depends on the programming language used, and is no part of SQL specification.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question