katenok29
14 years agoNew Contributor
How to insert Date type value into DB Table?
I use such string in delphi script to insert date-type value into table:
Cmd.CommandText := 'insert into MY_TABLE values(' '1' ', To_date(' '05.03.2010' ', ' 'dd.mm.yyyy' '))';
Cmd.CommandType := DB.adCmdText;
When I call the method RecSet := Cmd.Execute all is ok. But now I want to insert value using parameter. I wrote:
Cmd.CommandText := 'insert into MY_TABLE values(' '1' ', ?)';
Cmd.CommandType := DB.adCmdText;
Prm:= Cmd.CreateParameter('date', DB.adDate, adParamInput);
Prm.Value := StrToDate('05.03.2010');
Cmd.Parameters.Append(Prm);
...
Now, when I call the method "RecSet := Cmd.Execute; " script can not stop and when I interupt it the message "stopping..." appeares but script can't finish.
To stop the script execution the TestComplete process must be shuted down.
So, how can I insert into table value in date type field?
Cmd.CommandText := 'insert into MY_TABLE values(' '1' ', To_date(' '05.03.2010' ', ' 'dd.mm.yyyy' '))';
Cmd.CommandType := DB.adCmdText;
When I call the method RecSet := Cmd.Execute all is ok. But now I want to insert value using parameter. I wrote:
Cmd.CommandText := 'insert into MY_TABLE values(' '1' ', ?)';
Cmd.CommandType := DB.adCmdText;
Prm:= Cmd.CreateParameter('date', DB.adDate, adParamInput);
Prm.Value := StrToDate('05.03.2010');
Cmd.Parameters.Append(Prm);
...
Now, when I call the method "RecSet := Cmd.Execute; " script can not stop and when I interupt it the message "stopping..." appeares but script can't finish.
To stop the script execution the TestComplete process must be shuted down.
So, how can I insert into table value in date type field?