C#无法在代码中调用创建的数据集 [英] C# cant call created dataset in code

查看:97
本文介绍了C#无法在代码中调用创建的数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我有这个问题
我创建了一个名为DataReport的DataSet并将表从Sql Server放在其上.然后在表格上放置了reportviewer并设计了新报告

一切进展顺利

现在我不是自动使用连接字符串,而是扔了设置,反正我有此代码

daData1是tableadapter
DataReport是我创建的数据集
DataDetails是DataReport上表的名称
rp是reportviewer

daData1.SelectCommand =新的SqlCommand("SELECT * from DataDetails",cs);
DataReport .Clear();
daData.Fill( DataReport .DataDetails);

问题在于,一次一切都很好,工作正常,但是我的cpu崩溃了,没有保存并再次编写代码,但是现在DataReport无法正常工作,它突出显示为FORM而不是DataSET

我不知道发生了什么,

任何帮助谢谢你

解决方案

hii,
只需更改

daData.Fill(DataReport,"DataDetails");


如果相同的代码不起作用,请重新启动计算机,听起来好像是东西坏了.


Hello, I have this problem
I have created DataSet called DataReport and placed table from Sql Server on it. then on form I placed reportviewer and designed new report

everything went smoothly

now I am not using connectionstring automatically, but threw Settings, anyway I have this Code

daData1 is tableadapter
DataReport is dataset that I created
DataDetails is the name of the Table on DataReport
rp is reportviewer

daData1.SelectCommand = new SqlCommand("SELECT * from DataDetails", cs);
DataReport.Clear();
daData.Fill(DataReport.DataDetails);

problem is that at one time everything was fine, worked fine, but my cpu crashed, havent saved, and made code again, but now DataReport is not working, it highlights as FORM not as DataSET

I dont know what is going on,

any help thank you

解决方案

hii,
just change

daData.Fill(DataReport,"DataDetails");


If the same code is not working, restart your computer, sounds like something is broken.


这篇关于C#无法在代码中调用创建的数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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