get a data on my textbox from database using 3 layer architecture..

  • Thread starter Thread starter kamlesh jha
  • Start date Start date
K

kamlesh jha

Guest
here is my code using 3 layer but it is not working.

i have used these files in my code 1.BELayer, 2. DALayer, 3. BALayer and last 4. Main page

BELayer:
public string quantity { get; set; }
public string prod_id { get; set; }
public string party_id { get; set; }


DALayer page code:
//command for auto fill data into quantity table;
public SqlDataReader autofillparty_id(BEL beobj)
{
try
{

cmd = new SqlCommand("select * from product where prod_id='" + beobj.prod_id + "'", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spsearchpartyid";
cmd.Parameters.AddWithValue("@prod_id", beobj.prod_id);
con.Open();
SqlDataReader sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return sdr;

}
catch (Exception ex)
{
throw ex;
}

finally
{
con.Close();
}
}


BALayer code
//command for autofill data into table quantity..
public SqlDataReader autofillquantity(BEL beobj)
{
try
{
return daobj.autofillparty_id(beobj);
}
catch (Exception ex)
{
throw ex;
}
}

Main Page code::
private void button1_Click(object sender, EventArgs e)
{
if (baobj.autofillquantity(beobj).Read())
{
txtboxpartyidquant.Text = (beobj.party_id.ToString());

}

}
this code is not working i know problem is in my main page but i don't know how can i solve this problem please help me ...

Continue reading...
 
Back
Top