无法使用数据集加载datagridview中的多个数据源? [英] not able to load Multiple data source in datagridview using dataset ?

查看:76
本文介绍了无法使用数据集加载datagridview中的多个数据源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a windows forms application where i have to load different fee structures tables for different courses in one datagridview using the textbox but i do not know how to use the mulitple datasources for datagridview I have 20 fee structure which differ from each of them by the values in it I have a Textbox where i would retrieve the name of the table to be retrieved but how should i proceed further ?

I used the have made a DataSet named fSDataSet where all the datatables are stored Now i want to load the tables when i get the values from the form





private void fSDataSetBindingSource_CurrentChanged(object sender,EventArgs e)

{





BindingSource bindingsource = new BindingSource();

string getfeest =FYBIOTECH;

string s = @Data Source = SRINATH-PC\SQLEXPRESS; Initial Catalog = FS; Integrated Security = True; Pooling = False;

SqlConnection OK =新SqlConnection(s);

SqlDataAdapter getfeestructure = new SqlDataAdapter();

SqlCommandBuilder commandBuilder = new SqlComman dBuilder(getfeestructure);



SqlCommand cmd = new SqlCommand(@select * from+ getfeest,OK);

getfeestructure.SelectCommand = cmd;









DataTable dt = new DataTable(@ fsDataSet。+ getfeest);

dt.Locale = System.Globalization.CultureInfo.InvariantCulture;

getfeestructure.Fill(dt);

bindingsource.DataSource = dt;

dataGridView1.AutoResizeColumns(
DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);





}

private void button1_Click(object sender,EventArgs e)

{

fSDataSetBindingSource_CurrentChanged(sender,e);

}

现在错误是它没有显示其中的行而且我无法理解实际的错误

推荐答案

这篇关于无法使用数据集加载datagridview中的多个数据源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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