TADODataset.Parameters.Refresh results in incorrect parameter names

From: Jim (iambod_at_newsguy.com)
Date: 11/17/03


Date: Mon, 17 Nov 2003 10:58:40 -0400

Has anyone else seen this oddity (or am I just doing something
stupid?)

I am changing the CommandText of a TADODataset at runtime after
rebuilding the SQL to change the parameters.

So, for example, I assign the following SQL:

select [CODE], [DESCRIPTION]
from [tblCODES]
where ([CONTEXT] = :CONTEXT)
and ([HIDE] = 0)

After assigning .CommandText, I call .Parameters.Refresh

Now at this point, Parameters.Count = 1, but Parameters[0].Name =
'Param1', not 'CONTEXT' as it should be, which causes problems later
since the parameters are referenced by name (being runtime dependent)
... any suggestions?

The dataset is connected using the SQLOLEDB provider (MDAC 2.71) to
SQL2K

Jim



Relevant Pages

  • Re: Command object and batching stored procedure calls
    ... I'm using SQL Server. ... ADO Command object. ... 22 separate statements is the most I've been able to get in one CommandText, ... I'd appreciate it if you could point me to the Books Online where it's ...
    (microsoft.public.data.ado)
  • Re: Encryption key storage
    ... I have a few questions about my options to store encryption keys. ... values so we don't need to do an LDAP call for each individual session ... dispersed through SQL Reference and Supplied PL/SQL Packages ... SQL> create or replace context myctx using scott.setctx accessed ...
    (comp.databases.oracle.misc)
  • Re: Question on Package Variables
    ... The package spec was as simple as they come; ... package variable can be directly accessed from SQL, ... heard of context switches. ... memory of the other context. ...
    (comp.databases.oracle.server)
  • RE: sql tasks
    ... that is the owner of the job is the context it runs under. ... and one more note: will sql jobs (sorry for the ... The job will run under the account of the owner on SQL Level and on OS Level ...
    (microsoft.public.sqlserver.security)
  • Re: Best Way to Test Against a Database
    ... that I have my CommandText, ... If your database client library (and the server) supports the concept of "prepared" statements, this would be a very easy way to verify the correctness of the SQL statements without actually executing the command. ... "Preparing" a statement will send the SQL to the server and the server can use the SQL to build a query plan. ...
    (microsoft.public.dotnet.languages.csharp)