How prevent duplicates in combobox in windowsapplication using c#?
how to prevent duplicates in combobox in windowsapplication using c#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Sep 7, 2011, 2:36 PM
SELECT columnname FROM tablename GROUP BY columnname
Then bind the query to combobox
as
con.Open();
str = "select sname from student GROUP BY sname";
com = new SqlCommand(str, con);
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader["sname"]);
}
reader.Close();
con.Close();
Thanks
VulpesPosted Sep 7, 2011, 2:01 PM
Vilas GitePosted Sep 7, 2011, 10:26 AM
Hi Srinivas!
You can bind data from store procedure to combobox with primary key column table.
Thanks!
-----------------------------------------------------------------------
If this reply helps your post…then check "This is correct answer"
mangesh shelarPosted Sep 7, 2011, 7:39 AM