J
Jon Skeet [C# MVP]
Nicky said:Can I throw a SqlException manually?
Unfortunately not - there are no public (or even protected)
constructors

Nicky said:Can I throw a SqlException manually?
Nicky said:I wrote a stored proc like that:
--------------------------------------------------------
declare @nTest as int
set @nTest = 100000
while @nTest > 0
begin
select * from MyTable
set @nTest = @nTest - 1
end
---------------------------------------------------------
And then in C#
try
{
SqlCommand cmd = new SqlCommand("TimeoutTest", m_dbConn);
cmd.CommandTimeout = 1;
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}catch(SqlException ex)
{
.....
}
But even 1 min later, it does not throw a exception. It should throw
a time out exception 1 second later, is it right?
Jon Skeet said:Unfortunately not - there are no public (or even protected)
constructors![]()
time out exception 1 second later, is it right?Nicky said:I wrote a stored proc like that:
--------------------------------------------------------
declare @nTest as int
set @nTest = 100000
while @nTest > 0
begin
select * from MyTable
set @nTest = @nTest - 1
end
---------------------------------------------------------
And then in C#
try
{
SqlCommand cmd = new SqlCommand("TimeoutTest", m_dbConn);
cmd.CommandTimeout = 1;
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}catch(SqlException ex)
{
.....
}
But even 1 min later, it does not throw a exception. It should throw a