Rosenberg
Rosenberg

Reputation: 2454

Executing the contents of a memo on a TADOQuery

I have a really long list of sql commands on a memo, when I try to execute it I get the following error:

Parameter object is improperly defined. Inconsistent or incomplete information was provided.

The code to execute it:

Query.SQL.Text := Memo1.Lines.Text;
Query.ExecSQL;

I have a vague idea that the error is caused due to the way the query content was added, so, here's how I'm doing it now:

1) Memo1.Lines.LoadFromFile('Patch.sql');

2) Proceed to the query commands

As you can see, the contents of the memo is loaded from a file. Is there any other way to successfully do this?

P.S.: I'm using Microsoft SQL 2008.

Thank you!

Upvotes: 0

Views: 919

Answers (1)

jasonpenny
jasonpenny

Reputation: 3049

It looks like you're not using parameters, so set ParamCheck off

Query.ParamCheck := false;

If there is a colon ":" in a string in the SQL, the TADOQuery thinks it's a parameter

Upvotes: 3

Related Questions