Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Timeout Expired when Excuting CLR Trigger

Author  Topic 

Jster
Starting Member

21 Posts

Posted - 2006-12-06 : 10:01:57
I'm getting a timeout expired when executing a CLR Trigger. The error message is "The timeout period elapsed prior to completion of the operation or the server is not responding." Below is the bulk and idea of the trigger and there is obviously more lines.

public partial class triggers
{
[Microsoft.SqlServer.Server.SqlTrigger(Name = "SyncInsert", Target = "TestRemoteExec", Event = "After Insert")]
public static void SyncInsert()
{
using (SqlConnection conn = new SqlConnection("context connection=true"))
{
conn.Open();
sqlCommand sqlComm = new SqlCommand();
sqlComm.Connection = conn;
sqlComm.CommandText = "SELECT * FROM INSERTED";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM INSERTED",conn);
da.Fill(ds,"INSERTED");
foreach(DataRow drIns in ds.Tables["INSERTED"].Rows)
{
field1 = drIns["Field1"].ToString().Trim();
field2 = drIns["Field2"].ToString().Trim();
}
for(int i=0; i<50; i++)
{
sqlComm.CommandText = "SELECT * FROM TBL WHERE ID="+i
da.SelectCommand = sqlComm;
da.Fill(ds,"GROUP");
foreach(DataRow drGroup in ds.Tables["GROUP"].Rows)
{
sqlComm.CommandText = "SELECT * FROM TBLACCT WHERE ID="+drGroup["ID"].ToString().TRIM();
da.SelectCommand = sqlComm;
da.Fill(ds,"ACCT");
foreach(DataRow drAcct in ds.Tables["ACCT"].Rows)
{
//Do some validations/math/configurations.
}
}
}
}
}


Thanks,
Josh

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-06 : 10:03:03
Why do you post same question again?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75905


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Jster
Starting Member

21 Posts

Posted - 2006-12-06 : 10:48:01
Sorry, thought it was a developer question.

Thanks,
Josh
Go to Top of Page
   

- Advertisement -