Jump to content
Xtreme .Net Talk

CLRBOY

Members
  • Posts

    11
  • Joined

  • Last visited

CLRBOY's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you... it works excellent and economize me 2 try-catch blocks.
  2. Greetings, I have 3 SP and I want to build client-side(C#) transaction. this is how it looks like right now : I have one sqlconnection and three sqlcommands(each one per SP) bool InsertOne = false; bool InsertTwo = false; bool InsertThree = false; SqlTransaction myTransOne = sqlConnection1.BeginTransaction(); SqlTransaction myTransTwo = sqlConnection1.BeginTransaction(); SqlTransaction myTransThree = sqlConnection1.BeginTransaction(); sqlCommand1.Transaction = myTransOne; try { ....First SP..... myTransOne.Commit(); InsertOne = true; } sqlCommand2.Transaction = myTransTwo; try { ....Second SP..... myTransTwo.Commit(); InsertTwo = true; } sqlCommand3.Transaction = myTransThree; try { ....Third SP..... myTransThree.Commit(); InsertThree = true; } if ((InsertOne == false) || (InsertTwo == false) || (InsertThree == false)) { myTransOne.Rollback(); myTransTwo.Rollback(); myTransThree.Rollback(); MessageBox("........"); } the problem is at run-time. I get exception when I'm trying to assign the (An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll Additional information: SqlConnection does not support parallel transactions.) so what do I have to do ? to give every command it's own connection ?? or maybe their is another way to do this ? Any Answer will be appreciated.
  3. Greetings, how do I filter the rows in the same dataview with more then one variable to filter ? when I do this one after another it doesn't work.... :( myDataView.RowFilter = "ID = '" + hmnID + "'"; myDataView.RowFilter = "the_name = '" + the_name + "'"; CLRBOY
  4. thank you !!!! ;) :-\ :D i checked this out here but it didn't help :mad: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadataviewclassrowfiltertopic.asp
  5. how do i filter rows comparing them to a variable ? this works // Filter the dataview DataView myDataView = myDataSet.Tables["Customers"].DefaultView; myDataView.RowFilter = "Country = 'Argentina' "; this doesn't work // Filter the dataview string arg = "Argentina"; DataView myDataView = myDataSet.Tables["Customers"].DefaultView; myDataView.RowFilter = "Country = arg "; i just got a (The variable 'arg' is assigned but its value is never used) warning.....
  6. 10x....... it so simple...........
  7. Hi everybody :D I'm trying to execute a SP that selects rows. the problem is that i don't know how to get the results of the SP. I mean that the TSQL statement works fine in the query analyner but not in the WinApp. sqlCommand1.Parameters["@student_id"].Value = ID; sqlCommand1.Parameters["@first_name"].Value = f_name; sqlCommand1.Parameters["@last_name"].Value = l_name; sqlCommand1.ExecuteReader(); I assume that i shuld use the ExecuteReader ? am I right ? :( :confused: so how do i get the rows that were selected ? (in order to show them to the user ?) ?
  8. ok...i got it.... (when i'm inside the first child) Form3 InnerWindow = new Form3(); InnerWindow.MdiParent = this.ParentForm; InnerWindow.Show(); this.Close(); and now it works fine.. :rolleyes: 10x to all
  9. private void button1_Click(object sender, System.EventArgs e) { this.Close(); MainForm s = new MainForm(); Form3 InnerWindow = new Form3(); InnerWindow.MdiParent = s.MdiParent; InnerWindow.Show(); } now what happens is that form3 doesn't open inside the container.... the same is happens if i write: this.Close(); Form3 InnerWindow = new Form3(); InnerWindow.Show(); i can't understand how to set the parent.....(MainForm)
  10. Hi everybody I'm new with programming & VS.Net so i have many many questions... I have a MainForm that is "IsMdiContainer=true" and another Form with three buttons, each button opens different forms(lets say form3,form4,form5). when any button is clicked i need to close the form(with the three buttons) and open form3 (or form4/form5). The problem is that when i try to open form3/4/5 ,VS (in my fault) actually try to open it within the form with the three buttons (althought i close it) and got an exception ("The form that was specified to be the MdiParent for this form is not an MdiContainer"). private void button1_Click(object sender, System.EventArgs e) { this.Close(); MainForm s = new MainForm(); s.MdiParent = this.MdiParent; Form3 InnerWindow = new Form3(); InnerWindow.MdiParent = this; InnerWindow.Show(); } i looked here but it didn't help me (i'm new with programming......) http://www.xtremedotnettalk.com/showthread.php?t=85215
×
×
  • Create New...