Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
cmd = new SqlCommand("select Eid,Ename from temp order by Eid ";,con);
cmd.CommandType = CommandType.Text;
dr = cmd.ExecuteReader();
if (dr.HasRows == true)
{
    while (dr.Read())
        name.Add(dr["Eid"].ToString());

    con.Close();

    textBox4.AutoCompleteMode = AutoCompleteMode.Suggest;
    textBox4.AutoCompleteSource = AutoCompleteSource.CustomSource;
    textBox4.AutoCompleteCustomSource = name;
}
Posted
Updated 4-Jul-14 19:51pm
v2
Comments
Member 10918596 5-Jul-14 1:39am    
i used single value ...tell me multiple values how to add..

C#
cmd = new SqlCommand("select Eid+ ' '+ Ename as AutoCol from temp order by Eid ";,con);

then
C#
name.Add(dr["AutoCol"].ToString());
 
Share this answer
 
Hi Try This

C#
cmd = new SqlCommand("select Eid,Ename from temp order by Eid ";,con);
cmd.CommandType = CommandType.Text;
dr = cmd.ExecuteReader();
if (dr.HasRows == true)
{
    while (dr.Read())
        name.Add(dr["Eid"].ToString());
        name.Add(dr["Ename"].ToString());
 
    con.Close();
 
    textBox4.AutoCompleteMode = AutoCompleteMode.Suggest;
    textBox4.AutoCompleteSource = AutoCompleteSource.CustomSource;
    textBox4.AutoCompleteCustomSource = name;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900