Hi,
it shows the following error in combobox event coding?
Error:
it shows the following error in combobox event coding?
private void cmb_customername_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source=mars-104;initial catalog=marsweb;integrated security=true");
con.Open();
SqlCommand cmd = new SqlCommand(" select t2.compname,t2.compaddress,t2.invoiceno,t2.orderno,t2.ondate,t2.invoicedate,t2.amountstatus,t2.netamount,t2.netvat,t2.tamount,t1.particulars,t1.quantity,t1.perprice,t1.amount from tbl_report2 t2 left join tbl_report1 t1 on t1.invoiceno=t2.invoiceno", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds );
DataRow trow;
ds.Tables[0].PrimaryKey = (new DataColumn[]{//error shows here as :These columns don't currently have unique values.
ds .Tables [0].Columns [0]});//error shows here as :These columns don't currently have unique values.
trow = ds.Tables[0].Rows.Find(cmb_customername.Text);
txt_customeraddress.Text = trow["custaddress"].ToString();
txt_invoiceno.Text = trow["invoiceno"].ToString();
txt_orderno.Text = trow["orderno"].ToString();
}
Best,
Sudheep.