Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have got 3 tire wherecarry out my code in bussiness layer i run code for update
C#
public override bool LoadProperties2List(string TypeOfOperation)
   {

  SortedList Sl = new SortedList();
 
  Sl.Add("@CommandType", TypeOfOperation);
  Sl.Add("@UserName",UserName);
  Sl.Add("@SecondarySchool",SecondarySchool);
  Sl.Add("@University",University);
  Sl.Add("@Qualification",Qualification);
  Sl.Add("@JobTitle",JobTitle);
  Sl.Add("@Company",Company);
  Sl.Add("@PhotoUrl", PhotoUrl);
 
  ProcedureName = "MangeUserInfo";
  if (db.RunProcedure(ProcedureName, Sl) == 1)
  return true;
  else
  return false;

  }


 public bool updateUser(string User, string SecondaryS, string Unvi, string Qua, string jobtitle, string company)
 {
  this.UserName = User;
  this.SecondarySchool = SecondaryS;
  this.University = Unvi;
  this.Qualification = Qua;
  this.JobTitle = jobtitle;
  this.Company = company;
 
  if (Update())
  return true;
  else
  return false;
 }


and in data access layer

C#
public void ConnectDB(CommandType CT,string ProNameSQl)
 {
 cn = new SqlConnection("Data Source=.;Initial Catalog=Conversation;Integrated Security=True");
 cmd = new SqlCommand();

 cmd.Connection = cn;
 cmd.CommandType = CT;
 cmd.CommandText = ProNameSQl;
 cn.Open();
 }


 public int RunProcedure(string ProcedureName, SortedList Paraval)
 {
 ConnectDB(CommandType.StoredProcedure, ProcedureName);

 for (int x = 0; x < Paraval.Count; x++)
 {
 try
 {

 cmd.Parameters.AddWithValue(Paraval.GetKey(x).ToString(), Paraval.GetByIndex(x));
 }
 catch
 {
 ;
 }
 }
 return ExceNoneQuery();
 }


and then in another layer i use this method to call procedure process kind and run

C#
public bool Update()
 {
 return LoadProperties2List("u");
 }

at last layer presenation layer

i do that

C#
protected void btnsave_Click(object sender, EventArgs e)
  {
  //upadate info
  bool Result = false;
  UsersInfo Upd = new UsersInfo();

  try
  {
  Result = Upd.updateUser(username, TxtSecondarySchool.Text, TxtUniversity.Text, TxtQualification.Text, TxtJobTitle.Text, TxtCompany.Text);
  if (Result==true)

  lblMessage.Text = "Record Updated Successfully.";

  else

  lblMessage.Text = "Record couldn't updated";

  }
  catch (Exception ee)

  {

  lblMessage.Text = ee.Message.ToString();

  }  finally

  {

  Upd = null;

  }
}

when i run the code only the result is
lblMessage.Text = "Record couldn't updated";
what is the error which maks it not to work correctly ??

i alse find something strange that the textboxes doesnt take the new values it pass the same value despite change why ??? i need help ??
Posted

the error is ..

the textbox load in a routine in the Page Startup event, with the routine place outside the If IsNotPostback loop...

so the default value just reloaded every time the page is refreshed, and thus appear to be 'unchangeable'..

try it good luck
 
Share this answer
 
Even though you virtually have posted the whole source code here, its really difficult for some one here to find out exactly what is happening.

Visual Studio is your best friend. And trust me the debugger they have is one of the best ones to help you in this scenario.

If I were you, I would put a break-point in Update() function and see what is happening.

Btw, here is a link on MSDN on how to debug using Visual Studio.

http://msdn.microsoft.com/en-us/library/vstudio/sc65sadd.aspx[^]
 
Share this answer
 
Comments
ost3z 4-Aug-13 19:45pm    
thankx for your advice i really do that to follow and know what happened i find that all textboxes pass the old values which load in page load all them doesnt pass the new values and so update happened with the data and so nothing happened the question which i search for why textboxes dont pass the new values ??

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