Click here to Skip to main content
15,921,841 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am try to get db values to my combo box ,then i need a Read() method but i can't get that....plz help meeee?
Posted
Comments
Sergey Alexandrovich Kryukov 1-Dec-12 22:17pm    
Not a valid question. Read() -- what? Not everyone can read your mind.
--SA

dude getting db values in combobox is easy
while(dr.read())
(
combobox.items.add(dr[values].Tostring());
)
dr is reference variable of DataReader
 
Share this answer
 
hi dear,
check this message.

string SQL = " SELECT TableColoumName From TableName " ;
DataTable dt = DataManager.ExecuteQuery(SQL);
if (dt.Rows.Count; 0)
{
  comboBox1.DataSource = dtPaymentPurpose;
  comboBox1.DisplayMember = TableColoumName;
  comboBox1.ValueMember = TableColoumName;
  comboBox1.SelectedIndex = -1;
}
else
{
  comboBox1.DataSource = null;
}
 
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