Re: ExecuteNonQuery stops program

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: rafal (rx409_at_gazeta.pl)
Date: 01/16/05


Date: Sun, 16 Jan 2005 23:32:59 +0100


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.



Relevant Pages

  • Re: Transaction.Commit() and Transaction.Rollback()
    ... They are used to ensure that an entire group of commands succeeds or else none of them succeed. ... This is done through the use of a transaction log. ... The Begin Transaction, Commit Transaction, End Transaction & Rollback Transaction commands are ways to specify which groups of queries to treat as Atomic. ... Commit & End Transaction tells the database that your are finished with that atomic operation and that all the commands you had sent since the trasaction began should now get committed to the actual database tables. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Transaction Identifier in transaction replication
    ... Sql server shows the value of the transaction id when we execute following two commands: ... I need to read this value in custom stored procedure of subscribed database. ... In your case you can't modify the source app, ...
    (microsoft.public.sqlserver.replication)
  • Re: Multiple concurrent isolated transactions on ADO Dataset
    ... and an allocation is too great to warrant one short transaction, also, there ... > transaction and view should be updated after it. ... The commands are stacked up ... >> database transaction which succeeds or fails. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: transaction and open table
    ... some cmds only, and other cmds I do not use trasaction, esp those read ... If the transaction is properly isolated, then those commands that you execute outside of the transaction will not see the changes that you have done inside the transaction until the transaction is committed. ... Moreover, since the transaction will place locks on the database to accomplish the isolation, depending on what you are doing you risk that the database commands that you are executing outside of the transaction might get blocked waiting for the transaction to finish. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ExecuteNonQuery stops program
    ... Are these commands a part of a transaction? ... - Sahil Malik ... > exception not coming to the end of the method. ...
    (microsoft.public.dotnet.framework.adonet)