Forum Discussion
Microsoft SQL Server
Try to run it with this peace of code:
var sql =
`
// sql or procedure
`;
var conn = ADO.CreateCommand();
conn.ActiveConnection = connectionString;
conn.CommandType = adCmdText;
conn.CommandText = sql;
conn.CommandTimeout = 6000;
try {
var exe = conn.Execute();
} catch(exception) {
Log.Message("FAIL");
}
- Naresh_Surya5 years agoOccasional Contributor
Sorry, I am new to dealing with stored procs.
I assigned stored proc path to sql.
ActiveConnection = Connection String(includes catalog, username/password)
I didn't understand what to place at adCmdText.
- Naresh_Surya5 years agoOccasional Contributor
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?
- Wamboo5 years agoCommunity Hero
conn.CommandType = adCmdText; conn.CommandText = sql; conn.CommandTimeout = 6000;
adCmdText - You don't have to specify this, this parameter is the type of function to be executed.
CommandTimeout - This is the default time to run the script. Increase it as you wish.