shadidayan
دوشنبه 04 شهریور 1387, 14:37 عصر
با سلام
می خواهم comboBox ام را با اطلاعات sql پر کنم ولی فقط اولین سطر جدول را به من برمی گرداند.
private void filldatasetandview()
{
objdataset = new DataSet();
objadapter.Fill(objdataset, "table");
objdataview = new DataView(objdataset.Tables["table"]);
objcurrencymanger = (CurrencyManager)this.BindingContext[objdataview];
}
public Form1()
{
string _commandtext = "SELECT contery FROM table";
objconection = new SqlConnection(_conectionstring);
objadapter = new SqlDataAdapter(_commandtext, objconection);
InitializeComponent();
}
private void bindingfill()
{
//clera previors databinding
cbocountry1.DataBindings.Clear();
cbocountry1.DataBindings.Add("text", objdataview, "contery");
//clera previors databinding
toolStripStatusLabel1.Text = "Ready";
}
private void Form1_Load(object sender, EventArgs e)
{
filldatasetandview();
bindingfill();
}
می خواهم comboBox ام را با اطلاعات sql پر کنم ولی فقط اولین سطر جدول را به من برمی گرداند.
private void filldatasetandview()
{
objdataset = new DataSet();
objadapter.Fill(objdataset, "table");
objdataview = new DataView(objdataset.Tables["table"]);
objcurrencymanger = (CurrencyManager)this.BindingContext[objdataview];
}
public Form1()
{
string _commandtext = "SELECT contery FROM table";
objconection = new SqlConnection(_conectionstring);
objadapter = new SqlDataAdapter(_commandtext, objconection);
InitializeComponent();
}
private void bindingfill()
{
//clera previors databinding
cbocountry1.DataBindings.Clear();
cbocountry1.DataBindings.Add("text", objdataview, "contery");
//clera previors databinding
toolStripStatusLabel1.Text = "Ready";
}
private void Form1_Load(object sender, EventArgs e)
{
filldatasetandview();
bindingfill();
}