Click here to Skip to main content
15,891,938 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
data is not inserting, i could not find the problem, please have a look

C#
filename = System.IO.Path.GetFileName(upldphoto.PostedFile.FileName);
          filename = GetUniqueFileName(filename);

          bool a = obj.saveRecord(1,txtName.Text,txtPhone.Text,txtEmail.Text,txtAddress.Text,txtExpertise.Text,txtExp.Text,filename,txtQualification.Text);


this is function code

C#
public bool saveRecord(int action,string name,string phone,string email,string address,string expertise,string experience,string image,string qualification)
    {

        Database db = DatabaseFactory.CreateDatabase();
        DbCommand cmd = db.GetStoredProcCommand("SaveUpdateDocter");
        db.AddInParameter(cmd, "@action", DbType.Int32, action);
        db.AddInParameter(cmd,"@Name",DbType.String,name);
        db.AddInParameter(cmd,"@Email",DbType.String,email);
        db.AddInParameter(cmd,"@Address",DbType.String,address);
        db.AddInParameter(cmd,"@Mobile",DbType.String,phone);
        db.AddInParameter(cmd,"@Qualification",DbType.String,qualification);
        db.AddInParameter(cmd,"@Expertise",DbType.String,expertise);
        db.AddInParameter(cmd,"@Experience",DbType.String,experience);
        db.AddInParameter(cmd,"@ImgName",DbType.String,image);
        using (TransactionScope scope = new TransactionScope())
        {
            try
            {
                int a = cmd.ExecuteNonQuery();
                scope.Complete();
                if (a > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception e)
            {
                return false;
               
               
            }
            finally
            {
                cmd.Dispose();
            }
            
        }


    }
Posted
Updated 20-Sep-13 1:05am
v2
Comments
Orcun Iyigun 20-Sep-13 7:26am    
Are you getting any exceptions? If so give us some more details.
Member 10112611 20-Sep-13 7:37am    
can u give the query inside the procedure SaveUpdateDocter ?

1 solution

actually error that i was checking int a = cmd.ExecuteNonQuery(); instead of int a=db.ExecuteNonQuery(cmd);

thanks for all your concern :)
 
Share this answer
 

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