从数据库信息中过滤报告. [英] Filtering Reports from Database information.
问题描述
您好,我正在遵循此Visual Basic指令,并且完全按照它的指示进行操作,除了在C#中,什么都没有起作用.以下是我指的视频的链接.如何获得相同的代码以在C#中工作?我指的是视频中的过滤器和组合狐狸部分,我已经知道怎么做上半部分.任何帮助,我将不胜感激!!!谢谢
http://windowsclient.net/learn/video.aspx?v=142067 [ ^ ]
Hello I am following this Visual Basic instruction and I am doing exactly what it says, except in C# and nothing is working. Below is the link of the video I am referring to. How can I get this same code to work for C#? I am referring to the filter and the combo fox sections in the video, I already know how to do the first half. Any help I would greatly appreciate!!! Thanks
http://windowsclient.net/learn/video.aspx?v=142067[^]
推荐答案
好,我可以在C#中工作(使用我的数据库(不是罗斯文))
Ok I have it working in C# (Using my Database (Not northwind))
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dEV_ROB_KSWDataSetCountryList.vCustomers' table. You can move, or remove it, as needed.
this.vCustomersTableAdapter1.Fill(this.dEV_ROB_KSWDataSetCountryList.vCustomers);
// TODO: This line of code loads data into the 'DEV_ROB_KSWDataSet.vCustomers' table. You can move, or remove it, as needed.
this.vCustomersTableAdapter.Fill(this.DEV_ROB_KSWDataSet.vCustomers, "GB");
this.reportViewer1.RefreshReport();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//I put a try catch in here as it fell over at first using the SelectedItem.ToString() so try Catch saved it falling over in Debug :)
try
{
this.vCustomersTableAdapter.Fill(this.DEV_ROB_KSWDataSet.vCustomers, comboBox1.SelectedValue.ToString());
this.reportViewer1.RefreshReport();
}
catch (Exception)
{
//I know, bad practice of suppressing exceptions.... :(
}
}
我还动态地将这些项目添加到了组合框中.
(不过,我不得不添加一个单独的DataSet,因为它不想让我过滤当前的DataSet,这使我的生活更加轻松)
I also added the items to the combobox dynamically.
(I had to add a seperate DataSet though, as it didnt want to let me filter the current one, and it made my life easier)
SELECT DISTINCT [Default Country Code], [Default Country] FROM dbo.vCustomers
希望这对您有帮助,如果仍然没有乐趣,我会尝试将项目上传到某个地方.
Hope this helps you, if still no joy I will try and upload the project somewhere.
:(
由于某些原因,我仍然对此感到困难.也许您或某人现在可以为此做一个简短的步骤?再次感谢大家的帮助.
:((
:(
I am still having difficulty with this for some reason. Maybe you or someone can now give a short step by step for this? Again, thank you everyone for the help.
:((
这篇关于从数据库信息中过滤报告.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!