Click here to Skip to main content
14,773,218 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ALTER PROCEDURE dbo.Psave
    @id int,@name   nchar(10)
AS
    insert into Table1 values(@id,@name)
    RETURN


private void button2_Click(object sender, System.EventArgs e)
       {
           string _cs = @"Data Source=nafiseh-pc;Database=testlinq;Integrated Security = true;";
           using (DataClasses1DataContext dc = new DataClasses1DataContext(_cs))
           {
               dc.DeferredLoadingEnabled = false;
               try
               {

                   dc.Connection.Open();
                   dc.Transaction = dc.Connection.BeginTransaction();

                   dc.pSave(6,"k");

               }//end try
               finally
               {
                   if (null != dc.Connection && dc.Connection.State != System.Data.ConnectionState.Closed)
                   {
                       dc.Connection.Close();
                   }
               }//end finaly
           }//end using
       }



but dont any data insert to Table1.
help me
Posted
Updated 12-May-12 14:19pm
v2
Comments
Maciej Los 12-May-12 19:36pm
   
Sandeep Mewara 13-May-12 1:22am
   
Question not clear. Please rephrase and elaborate a little.
Ganesan Senthilvel 13-May-12 3:12am
   
Could you trace the stored proc activities using SqlTracer tool

1 solution

With a quick look the only thing I noticed is that you start a transaction correctly, but where do you commit it? If it isn't committed, the transaction is automatically rolled back when the session ends so you would see no data.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900