Re: ExecuteNonQuery stops program
From: Sahil Malik (contactmethrumyblog_at_nospam.com)
Date: 01/17/05
- Next message: W.G. Ryan eMVP: "Re: Performace problem with DataView.RowFilter"
- Previous message: Sahil Malik: "Re: Annoyance: Intellisense doesn't work for referenced typed datasets"
- In reply to: rafal: "Re: ExecuteNonQuery stops program"
- Next in thread: W.G. Ryan eMVP: "Re: ExecuteNonQuery stops program"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 16 Jan 2005 21:33:33 -0500
Okay so ..
You don't have a transactional scenario.
The code hangs after an unpredicatable # of updates.
Are you getting the same behavior when you run 13117 updates from Query
Analyzer?
Can you run a quick experiment?
a) Backup your database.
b) Run your code - see at what count it blocks.
c) Now restore the db
d) Run the code again - see at what count it blocks.
Does it block at exactly the same count between b and d?
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
"rafal" <rx409@gazeta.pl> wrote in message
news:cseq33$6aq$1@inews.gazeta.pl...
>
> Użytkownik "Sahil Malik" <contactmethrumyblog@nospam.com> napisał w
> wiadomości news:uivGzOA$EHA.1452@TK2MSFTNGP11.phx.gbl...
>> Are these commands a part of a transaction?
>>
>> - Sahil Malik
>> http://dotnetjunkies.com/weblog/sahilmalik
>>
>>
>> "rafal" <rx409@gazeta.pl> wrote in message
>> news:csecfr$50q$1@inews.gazeta.pl...
>> > 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();
>> > }
>> >
>> >
>>
>>
> No, separate inserts into database.
>
>
- Next message: W.G. Ryan eMVP: "Re: Performace problem with DataView.RowFilter"
- Previous message: Sahil Malik: "Re: Annoyance: Intellisense doesn't work for referenced typed datasets"
- In reply to: rafal: "Re: ExecuteNonQuery stops program"
- Next in thread: W.G. Ryan eMVP: "Re: ExecuteNonQuery stops program"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|