After enter save button i need the data in the comboboxlist
after executing application if i insert some data on textbox when i click save button it will store in database but it doesn't show it in the combobox list. it show when after close the application again if i will execute then i can view in the comboboxlist. how to view spantaneously after enter save button i need the data in the comboboxlist without close the application.


Khargesh RajputRank #616 · 3.9K reputationPosted Mar 25, 2015, 10:40 PM EDT
Durga VelusamyRank #4,868 · 321 reputationPosted Mar 25, 2015, 10:57 PM EDT
why like that why i cann't get after store why it will not update spantaneously? after close the application then open the application means its there in the list.
Khargesh RajputRank #616 · 3.9K reputationPosted Mar 25, 2015, 11:04 PM EDT
Durga VelusamyRank #4,868 · 321 reputationPosted Mar 25, 2015, 11:26 PM EDT
example i have customername, phone ,address like that
if i save data using save option and i am retrieving data using search option using customername. after saving then sequentially i thought to retrieve it. only, the problem is i can retrieve, when i have given full name, but i cant get the name in combolist sequentially. it will be there after close application then open means then only the combobox is updated with last activity either saved data or deleted data .
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted Mar 25, 2015, 11:53 PM EDT
public void call()
{
con.Open();
string str = "select * from pankaj";
SqlDataAdapter da = new SqlDataAdapter(str, con);
DataTable tab = new DataTable();
da.Fill(tab);
comboBox1.DataSource = tab;
comboBox1.ValueMember = "take";
comboBox1.DisplayMember = "take";
con.Close();
}
private void pankaj(object sender, EventArgs e)
{
con.Open();
string str = "insert into pankaj values('" + textBox2.Text + "')";
SqlCommand com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
call();
}
after each click i am find new data in combobox........