Click here to Skip to main content
15,898,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
IN BUSSINEES ACCESS LAYER:
C#
#region "Variables"
  protected int _uid =0;
  protected string _name = "";
  protected string _father = "";
  public int _type = 0;
  #endregion

  #region "Properties"
  public int Uid
  {
      get
      {
          return _uid;
      }


IN Cs :
C#
BAL_insert Obj = new BAL_insert();
   protected void Page_Load(object sender, EventArgs e)
   {

   }
   protected void Button1_Click(object sender, EventArgs e)
   {
       Obj.Uid = TextBox1.Text;
       Obj.Name = TextBox2.Text;
       Obj.Father = TextBox3.Text;
Posted

Use it..

C#
protected void Button1_Click(object sender, EventArgs e)
   {
       Obj.Uid = Convert.ToInt32(TextBox1.Text);
       Obj.Name = TextBox2.Text;
       Obj.Father = TextBox3.Text;
   }
 
Share this answer
 
you are passing Textbox string data into integer Uid that is why this error is coming

either change Uid datatype as string or convert you TextBox1.text to integer


protected string _uid =0;
...
...
 public string Uid
  {
      get
      {
          return _uid;
      }
 
Share this answer
 
Isn't that apparent that the type of TextBox.Text is string, and this is not int?
Please see:
https://msdn.microsoft.com/en-us/library/system.int32.tryparse%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.int32.parse%28v=vs.110%29.aspx[^].

—SA
 
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