Hi,
i have the problem in my code.if i wrote the code in selectedindexchanged it shows the error as invalid columns.please do the needful.
Errors:
Invalid column name 'compaddress'.
Invalid column name 'particulars'.
Invalid column name 'perprice'.
Invalid column name 'amount'.
Invalid column name 'netvat'.
Invalid column name 'tamount'.
Invalid column name 'netamount'.
private void cmb_companyname_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con=new SqlConnection ("data source=mars-104;initial catalog=marsweb;integrated security=true");
SqlCommand cmd=new SqlCommand ("select t2.compaddress,t1.invoiceno,t1.orderno,t1.ondate,t1.particulars,t1.perprice,t1.amount,t2.netvat,t2.tamount,t2.netamount from tbl_report2 t1,tbl_report1 t2 where t1.compname=@compname and t2.compname=@compname",con );
cmd.Parameters.AddWithValue("@compname",cmb_companyname .SelectedItem .ToString ());
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
txt_customeraddress.Text = dt.Rows[0]["compaddress"].ToString();
txt_invoiceno.Text = dt.Rows[0]["invoiceno"].ToString();
txt_orderno.Text = dt.Rows[0]["orderno"].ToString();
txt_ondate.Text = dt.Rows[0]["ondate"].ToString();
cmb_particulars.Text = dt.Rows[0]["particulars"].ToString();
txt_quantity.Text = dt.Rows[0]["quantity"].ToString();
txt_perprice.Text = dt.Rows[0]["perprice"].ToString();
txt_amount.Text = dt.Rows[0]["amount"].ToString();
txt_vat.Text = dt.Rows[0]["netvat"].ToString();
txt_totalamount.Text = dt.Rows[0]["tamount"].ToString();
txt_netamount.Text = dt.Rows[0]["netamount"].ToString();
}
Best,
Sudheep.