ExecuteNonQuery stops program
From: rafal (rx409_at_gazeta.pl)
Date: 01/16/05
- Next message: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Previous message: Mary Chipman: "Re: Approximating Decimal Type consistency from DB to .NET"
- Next in thread: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Reply: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Reply: W.G. Ryan eMVP: "Re: ExecuteNonQuery stops program"
- Reply: rafal: "Re: ExecuteNonQuery stops program"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 16 Jan 2005 19:40:58 +0100
I run this code below which is part of method.
ds.Tables["tabelka"].Rows.Count has always value 13117 but sometimes the
code executes only 1000 or 12000 times etc and freezes without error or
exception not coming to the end of the method. In debug window it prints
"before" which means it stops during or before executing
upd.ExecuteNonQuery();
I don' know what is going on. Thanks for help.
for (int y = 0; y < ds.Tables["tabelka"].Rows.Count; y++)
{
string account_id = ds.Tables["tabelka"].Rows[y][0].ToString();
string date = ds.Tables["tabelka"].Rows[y][1].ToString();
int temp1 = 0;
double temp2 = 0.00;
int val = 0;
val = y/1874;
string updateCommand = "update wielka set "+columnName+"="+val.ToString()+ "
where account_id="+account_id+" and date="+date;
SqlConnection sqlConnection3 = new SqlConnection(connString);
SqlCommand upd = new SqlCommand(updateCommand, sqlConnection3);
if (sqlConnection3.State.ToString() == "Closed")
{
sqlConnection3.Open();
}
try
{
Console.WriteLine("before");
upd.ExecuteNonQuery();
Console.WriteLine("discretization "+y);
}
catch (Exception exc)
{
Console.WriteLine("Exception 3: "+exc.ToString());
Console.WriteLine("UpdateCommand: "+updateCommand);
}
sqlConnection3.Close();
}
- Next message: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Previous message: Mary Chipman: "Re: Approximating Decimal Type consistency from DB to .NET"
- Next in thread: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Reply: Sahil Malik: "Re: ExecuteNonQuery stops program"
- Reply: W.G. Ryan eMVP: "Re: ExecuteNonQuery stops program"
- Reply: rafal: "Re: ExecuteNonQuery stops program"
- Messages sorted by: [ date ] [ thread ]