Hii
I have a application in c#.net windows application.
i have a column named quality in sql server database table.
Now i want to use it as my autocomplete source for one of my textbox.
How can i do this?
Please help me
Thanks in advance
How to use autocomplete from database column
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Sitakanta Padhy2 reputationPosted Sep 27, 2010, 12:09 AM EDT
// Check for state of connction
if ((con.State == ConnectionState.Closed)) {
con.Open();
}
//Query to slect usernames from your database table
qrystr = "select distinct username from users";
da = new MySqlDataAdapter(qrystr, con);
da.Fill(ds, "users");
for (int i = 0; i <= ds.Tables("users").Rows.Count - 1; i++) {
UsernameTextBox.AutoCompleteCustomSource.Add(ds.Tables("users").Rows(i).Item(0));
}