donvittorio
Programmer
Hi,
I'm trying to use an sql insert statement using ADO parameters, and I can't get the value of the parameter into the db, and it's driving me nuts! I'm using SQL Server 2000, Delphi 4 and ADO 2.1 (there's nothing like modern technology is there?!)
The code is simply this:
The insert statement executes but the value of TextCol is null, what do I have to do to get the value of the parameter into the db??!! I've tried using
but that didn't help either. Any pointers would be much appreciated.
Steve
I'm trying to use an sql insert statement using ADO parameters, and I can't get the value of the parameter into the db, and it's driving me nuts! I'm using SQL Server 2000, Delphi 4 and ADO 2.1 (there's nothing like modern technology is there?!)
The code is simply this:
Code:
procedure TForm1.WriteToDB(aConn: _Connection);
var
Command: _Command;
Param: Parameter;
RecsAff, Params: OleVariant;
begin
Command := CoCommand.Create;
Command.CommandText := 'Insert into MyTable(MyID, TextCol)'+
' Values('''+VarToStr(FID)+''', ?)';
Command.CommandType := adCmdText;
Command.Set_ActiveConnection(aConn);
Param := Command.CreateParameter('TextCol', adVarChar, adParamInput, 10, 'testval');
Command.Parameters.Append(Param);
Command.Execute(RecsAff, Params, adExecuteNoRecords);
end
The insert statement executes but the value of TextCol is null, what do I have to do to get the value of the parameter into the db??!! I've tried using
Code:
Param.Value := 'testval';
but that didn't help either. Any pointers would be much appreciated.
Steve