Dear experts
I am following way for C#.NET Programs..Keeping in mind that many user will use program at a time
STEP 1 : Generate Unique Id from any table
STEP 2 : Generate transaction in following way
SqlConnection Con = new SqlConnection;
Con.BeginTransaction
STEP 3: My sql statements(Insert/Update/Delete)
STEP 4: Commit or Rollback
just need whether I should do any changes or not.Is the above way is good if there are more users using software at a time.
Regards
Mayur

Narasimha Reddy ChennupalliRank #1,163 · 1.6K reputationPosted Jun 26, 2015, 9:13 AM EDT
SqlConnection conn = new SqlConnection(constring);
//Step 1: Open the Sql connection
conn.Open();
SqlCommand cmd = new SqlCommand("insert into moneytrans values(" + cmbuserid.SelectedItem.ToString() + "," + txtamount.Text + ")", conn);
//Step 2: Begin the transaction
SqlTransaction trans = conn.BeginTransaction();
cmd.Transaction = trans;
try
{
cmd.ExecuteNonQuery();
//Step 3: Commit the transaction
trans.Commit();
MessageBox.Show("Transaction Complted. ");
}
catch (Exception)
{
//Step 4: If anything happens Roll back the transaction
trans.Rollback();
MessageBox.Show("Transaction Failed..");
}
}
conn.Close();
I hope this will help you.
Rathrola Prem KumarRank #307 · 8.2K reputationPosted Mar 20, 2017, 5:35 PM EDT
Ibrahim SiddiqueRank #1,837 · 807 reputationPosted Mar 20, 2017, 7:49 PM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 20, 2017, 8:25 PM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Mar 20, 2017, 9:28 PM EDT