<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Are you currently setting the parameter values by index then?<br>
<br>
Using regular expressions, search <br>
<br>
\'(\w)+\s\=\s\? <br>
<br>
and replace with<br>
<br>
'$1 = :$1<br>
<br>
so that<br>
<br>
StringField =?,<br>
<br>
becomes<br>
<br>
StringField = :StringField,<br>
<br>
It should take no time at all.<br>
<br>
Todd.<br>
<br>
<br>
<br>
<blockquote
cite="mid:CAJLpVUPZhUzAupHGqonokYiwWB7=n_uS96nL_uv9-YXUFvhfCg@mail.gmail.com"
type="cite">We've porting code to Delphi XE2, and need to change
our data access components from third party ODBCExpress which is
no longer in business, to dbExpress's TSQLQuery.<br>
<br>
We have parametrized SQL query such as:<br>
<br>
sSQL :=<br>
'UPDATE ZTestData SET '+<br>
' StringField =?, '+<br>
' IntField = ?, '+<br>
' DecimalField = ?, '+<br>
' BooleanField = ?, '+<br>
' DateTimeField = ?, '+<br>
' TextField = ? '+<br>
' WHERE UniqueID = 3';<br>
<br>
if we use the following code:<br>
<br>
var<br>
qry:TSQLQuery;<br>
begin<br>
qry.Close;<br>
qry.SQL.Text := sSQL;<br>
ShowMessage(IntToStr(qry.Params.Count));<br>
end;<br>
<br>
It returns 0, so we're unable to get the bindings working, but if
we change sSQL to:<br>
<br>
sSQL :=<br>
'UPDATE ZTestData SET '+<br>
' StringField =:Param1, '+<br>
' IntField = :Param2, '+<br>
' DecimalField = ?, '+<br>
' BooleanField = ?, '+<br>
' DateTimeField = ?, '+<br>
' TextField = ? '+<br>
' WHERE UniqueID = 3';<br>
<br>
It returns 2.<br>
<br>
It's going to be a big hassle to change all the SQL queries to the
new parameter syntax. Is there anyway for the TSQLQuery to
recognize the ? syntax?<br>
<br>
I see that DBXCommon.TDBXCommand uses the ? syntax:<br>
<br>
<a moz-do-not-send="true"
href="http://www.andreanolanusse.com/en/parameterized-queries-with-dbexpress-dbx-framework/">http://www.andreanolanusse.com/en/parameterized-queries-with-dbexpress-dbx-framework/</a><br>
<br>
But it would mean throwing away our code that uses TSQLQuery.
What's the quickest/easiest way to resolve this? What's the
difference between TSQLQuery and TDBXCommand anyway, in terms of
what's relevant to me?<br>
<br>
Robo<br>
<br>
<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe</pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<b>Passion</b> is no substitute for <b>reason</b></div>
</body>
</html>