我试图获取db值到我的组合框,然后我需要一个Read()方法,但我不能得到它.... PLZ帮助meeee? [英] 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?

查看:64
本文介绍了我试图获取db值到我的组合框,然后我需要一个Read()方法,但我不能得到它.... PLZ帮助meeee?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将db值添加到我的组合框中,然后我需要一个Read()方法,但我不能得到它.... plz help meeee?

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?

推荐答案

dude在组合框中获取db值很容易

而(dr.read())



combobox.items .add(dr [values] .Tostring());



dr是DataReader的引用变量
dude getting db values in combobox is easy
while(dr.read())
(
combobox.items.add(dr[values].Tostring());
)
dr is reference variable of DataReader


亲爱的,

查看此消息。



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;
}


这篇关于我试图获取db值到我的组合框,然后我需要一个Read()方法,但我不能得到它.... PLZ帮助meeee?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆