Page 1 of 1

TMSUpdateSQL

Posted: Fri 16 Dec 2005 14:45
by jfpicard
Got a little conversion question here.

With the TUpdateSQL I was able to set parameters in the 'Query' for the update with the following code :

Usql.Query[ukInsert].ParamByName('test').AsString := SubStr;

With the TMSUpdateSQL, the Query property doesn't exist. So that code doesn't work. There is the SQL property, but it's only TStrings. Am I missing something ?

Thanks.

Jean-François Picard

Posted: Mon 19 Dec 2005 09:32
by Ikar
SDAC doesn't provide such functionality.

Yet more correct and easier it would be not to use TMSQupdateSQL. If there is a unique key field in a table, SDAC SQL Generator creates update queries automatically.

Posted: Wed 21 Dec 2005 17:47
by jfpicard
But when you want to add a Foreign key into your query to update the table, a TUpdateSQL is very usefull.

We always doing something like:

usqltest.Query[UpdateKind].ParamByName('IDFK').AsString := qry.FieldByName('ID').AsString;

With usqltest bind to the qrytest fo example. For simple update, we don't use any TUpdateSQL.

Thanks.

Posted: Fri 23 Dec 2005 13:45
by Ikar
> Use MSQuery.BeforeUpdateExecute event to set proper parameter's properties.