ADO Stream Help
opie9090_at_yahoo.com
Date: 12/28/04
- Previous message: Pierre: "Re: Cursortype, cursor location and Zombie state"
- Next in thread: opie9090_at_yahoo.com: "Re: ADO Stream Help"
- Reply: opie9090_at_yahoo.com: "Re: ADO Stream Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Dec 2004 13:59:22 -0800
I am trying to get the MS ADO Stream object to open, but it is acting
strange depending on where I put the call to stream.open in my code.
If I put it before the cmd.execute line it works fine. However if I
put it after the cmd.execute line. The error I get if I put it AFTER
the cmd.execute line is
'arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another'. I imported the 2.8 MS ADODB type
library. What I am trying to do in reality is use a stream later on in
my code, but it doesn't matter if I am using it in another member
method or not (ie out of cmd's scope), I still can't get it to open
unless I put it BEFORE the cmd.execute
My code is below with comment. CAN SOMEONE PLEASE HELP
Thanks
Mike
uses .....ADODB_TLB, comobj.....
...
procedure TForm1.FormCreate(Sender: TObject);
var
tmpID : Integer;
param : Parameter;
cmd : Command;
conn : Connection;
rs : RecordSet;
stm : Stream;
begin
tmpID := -1;
conn := Connection(CreateOLEObject('ADODB.Connection'));
conn.ConnectionString := 'Provider=SQLOLEDB.1;Password=cas;User
ID=cas;Data Source=FIDS-SERVER;';
conn.Open('', '', '', -1);
cmd := Command(CreateOLEObject('ADODB.Command'));
stm := Stream(CreateOLEObject('ADODB.Stream'));
cmd.Set_ActiveConnection(conn);
cmd.CommandText := 'spGetID';
cmd.CommandType := 4;
cmd.Parameters.Refresh;
// *******
// PUTTING IT HERE WORKS
// *******
// stm.Open(EmptyParam, adModeUnknown, adOpenStreamUnspecified, '','');
rs := cmd.Execute(EmptyParam,EmptyParam,adCmdStoredProc);
// *******
// PUTTING IT HERE CAUSES ERROR
// *******
// stm.Open(EmptyParam, adModeUnknown, adOpenStreamUnspecified, '','');
tmpID := rs.Fields.Item[0].Value;
conn.Close;
end;
- Previous message: Pierre: "Re: Cursortype, cursor location and Zombie state"
- Next in thread: opie9090_at_yahoo.com: "Re: ADO Stream Help"
- Reply: opie9090_at_yahoo.com: "Re: ADO Stream Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]