Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages
Started by John R Young
Wed, 03 Jan 2001 14:33
TADOCommand - changing CommandText ineffective
Author: John R Young
Date: Wed, 03 Jan 2001 14:33
Date: Wed, 03 Jan 2001 14:33
17 lines
1449 bytes
1449 bytes
I am Using a TADOCommand to talk to MS SQL Server 7.0 (cppb 5) At design-time, CommandText is "insert into xxx (column,....) values (:parameter, ...." I use a combobox to select target table name & replace "xxx" by, say, "yyy". Inspecting CommandText with debugger immediately before the Execute() statement shows "insert into yyy (column,....) values :parameter, ....", as expected, but the insert goes into table xxx !!!??? Why? and what is the remedy? Notes... The TADOCommand is not connected through a TADOConnection. It has Prepared=true (at design), and is not explicitly unprepared and reprepared. Most grateful for any explanation. John Young
Re: TADOCommand - changing CommandText ineffective
Author: John R Young
Date: Thu, 04 Jan 2001 00:49
Date: Thu, 04 Jan 2001 00:49
35 lines
2335 bytes
2335 bytes
OK. I have looked at the source code !... property CommandText: WideString read FCommandText write SetCommandText; ... this appears to allow editing of the supoosedly private FCommandText in-situ using WideString.Delete and Insert, as I had done, via its exposure in the property. This changes the text without calling the AssignCommandText procedure which is needed to change the Command in the underlying ADO object. The remedy is to copy the wideString out, edit it and assign it back in. The latter uses SetCommandText which does call AssignCommandText. Am I missing something, or should this exposure of FCommandText be considered to be a bug? John R Young John R Young wrote: > > I am Using a TADOCommand to talk to MS SQL Server 7.0 (cppb 5) > At design-time, CommandText is "insert into xxx (column,....) values > (:parameter, ...." > I use a combobox to select target table name & replace "xxx" by, say, "yyy". > Inspecting CommandText with debugger immediately before the Execute() > statement shows "insert into yyy (column,....) values :parameter, ....", as > expected, but the insert goes into table xxx !!!??? Why? and what is the > remedy? > > Notes... > The TADOCommand is not connected through a TADOConnection. > It has Prepared=true (at design), and is not explicitly unprepared and > reprepared. > > Most grateful for any explanation. > John Young
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads