Hi,
Thanks for replying to me.can you please explain the process for combining the tables with their data and structure.actually i have a combobox.if i selected any value from the combo box it has to display the remaining textbox values.this is my requirment.Here is my code.please do the needful.
public partial class UpdateCustomerInvoice : Form
{
public UpdateCustomerInvoice()
{
InitializeComponent();
}
string str;
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
DataSet ds1;
private void UpdateCustomerInvoice_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source=mars-104;initial catalog=marsweb;integrated security=true");
SqlCommand cmd = new SqlCommand("select custname,custaddress from tbl_customer", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
foreach (DataRow row in ds.Tables[0].Rows)
{
cmb_customername.Items.Add(row.ItemArray[0].ToString());
}
con.Close();
}
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 custname,custaddress from tbl_customer", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds );
DataRow trow;
ds.Tables[0].PrimaryKey = (new DataColumn[]{
ds .Tables [0].Columns [0]});
trow = ds.Tables[0].Rows.Find(cmb_customername.Text);
txt_customeraddress.Text = trow["custaddress"].ToString();
}
}
}
with this code i can display only customer address.But,i need to display invoiceno,orderno,ondate,invoicedate,particulars,quantity,perprice,amount,netamount,netvat,tamount etc...with the help of combobox selected value.but,it wont shows the remaining.For that reason i want to combine those tables.in this regarding you can help me please.if you want any doubt please let me know.
Best,
Sudheep.
Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator