Contributions
Re: How to pass Date as in parameter for stored proc
SureWamboo. // Adding a return parameter SProc.Parameters.AddParameter() SProc.Parameters.Items(0).name = "RETURN_VALUE" SProc.Parameters.Items(0).DataType = adInteger SProc.Parameters.Items(0).Direction = adParamReturnValue SProc.Parameters.Items(0).Value = null //Adding an in parameter SProc.Parameters.AddParameter() SProc.Parameters.Items(1).name = "@timeOfBuild" SProc.Parameters.Items(1).DataType = adDate SProc.Parameters.Items(1).Value = aqConvert.strtoDate("2020-05-19") SProc.CommandTimeout = 75; SProc.ExecProc();2.4KViews1like0Comments- 1.4KViews0likes3Comments
Re: How to pass Date as in parameter for stored proc
Wamboo, Thank you for taking time to help here. Though I accepted your solution. I am not able to validate the response from Stored proc and also doesn't know if it's executed or not. var sql = "EXEC <stored procname> @date = N'"+Date+"'" var conn = ADO.CreateCommand(); conn.ActiveConnection = "Provider=SQLOLEDB;Initial Catalog=<>;User ID=<>;Password=<>;Data Source= \"*\" "; conn.CommandType = adCmdText; conn.CommandText = sql; conn.CommandTimeout = 65000; try { var RecSet = conn.Execute(); while (!RecSet.EOF) { Log.Message(RecSet.Fields.Item("Return Value").Value); RecSet.MoveNext(); }; // Log.Message(exe); } catch(exception) { Log.Message(exception); Log.Message("FAIL"); } Exception at while block saying unable to perform operation on closed object. If I increase the timeout to 70000 it's giving query timeout exception. Can you please tell me what I am missing here1.4KViews0likes5CommentsRe: How to pass Date as in parameter for stored proc
I've seen we can execute stored proc using Query and tried executing SQL query EXEC <stored proc name>@date=N'date'; It returned query timedout wrror as my stored proc takes more than 30 secs (close to one minute to get executed). Is there any way to mention querytimeout as we do commandtimeout in stored proc?1.9KViews0likes8Comments- 1.9KViews0likes11Comments
Re: How to pass Date as in parameter for stored proc
Wamboo, Thanks for your reply. Yes, I am trying to execute a Stored proc which is available in DB. I checked the parameter DataType in DB and is "datetime" As mentioned in below screenshot I tried those two TestComplete constants but I was getting the errors mentioned in my previous comment. Am I missing anything here?1.9KViews0likes13CommentsRe: How to pass Date as in parameter for stored proc
Hi Thanks for that link. I have tried two TestComplete ADO constants for Date/DateTime mentioned but i am running into below issues Tried adDateas Datatype but got into "application uses a value of the wrong type for the current operation" issue. Tried adDBTimeStampbut got into "arguments are of the wrong type, are out of acceptable range, or are in conflict with one another" Can you confirm if it's because I am passing date in String format? If so, how can we pass the same?1.9KViews0likes15Comments