Re: FMTONLY problems
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Tue, 29 May 2007 17:53:39 -0400
Bob wrote:
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:OQAeAwYoHHA.4516@xxxxxxxxxxxxxxxxxxxxxxx
You failed to provide the ADO code that is causing this behavior.
I'm using delphi, which has a wrapper around the ADO objects. I spent
a whole lot of time trying to work out what it was doing that was
causing the problem.
The first time it runs, it creates the bad FMTONLY statment and runs.
The second time it it does the bad FMTONLY, sets SET NO_BROWSETABLE
OFF, runs the SQL 3 times, SET NO_BROWSETABLE ON, does a correct
FMTONLY, SET NO_BROWSETABLE OFF, then executes the SQL again.
Below is the simplest example that I could come up with that exibits
the issue. Below that is a script to create a test database.
procedure TForm1.FailTest;
var
Conn: _Connection;
Cmd: _Command;
Records: _Recordset;
ADOCommandConstructionObj: ADOCommandConstruction;
ICommandObj: ICommand;
begin
Conn := CoConnection.Create;
Cmd := CoCommand.Create;
Records := CoRecordset.Create;
Conn.Open(
'Provider=SQLNCLI.1;' +
'Integrated Security=SSPI;' +
'Persist Security Info=False;' +
'Initial Catalog=TestDB;' +
'Data Source=.\SQL2005',
'', '', adConnectUnspecified);
Cmd.Set_ActiveConnection(Conn);
Cmd.CommandText :=
'IF NOT EXISTS ( ' + CRLF +
' SELECT SystemScanfileKey ' + CRLF +
' FROM SystemScanfileScan ' + CRLF +
' WHERE SystemScanfileKey = ? ' + CRLF +
' AND ScanKey = ? ' + CRLF +
' ) ' + CRLF +
'BEGIN ' + CRLF +
' INSERT INTO SystemScanfileScan ' + CRLF +
' (SystemScanfileKey, ScanKey) ' + CRLF +
' VALUES ' + CRLF +
' (?, ?) ' + CRLF +
' SELECT 1 ' + CRLF +
'END ' + CRLF +
'ELSE ' + CRLF +
' SELECT 0 ' + CRLF ;
OleCheck(Cmd.QueryInterface(ADOCommandConstruction,
ADOCommandConstructionObj));
OleCheck(ADOCommandConstructionObj.OLEDBCommand.QueryInterface(ICommand,
ICommandObj));
// there was a whole lot more code here to get parameter types,
names and direction etc
So do you get the FMTonly problem if you execute this Command without
bothering to get paameter types, etc?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: FMTONLY problems
- From: Bob
- Re: FMTONLY problems
- References:
- FMTONLY problems
- From: Bob
- Re: FMTONLY problems
- From: Bob Barrows [MVP]
- Re: FMTONLY problems
- From: Bob
- FMTONLY problems
- Prev by Date: Re: Can SQL do this?
- Next by Date: Re: Mdac 2.8 para Windows Vista
- Previous by thread: Re: FMTONLY problems
- Next by thread: Re: FMTONLY problems
- Index(es):
Relevant Pages
|
|