搜寻有误 [英] having error for searching
问题描述
我正在为应用程序使用Crystal Report来显示searchig的结果.
在主要形式中,我使用了四个texbox来过滤日期和两个想法之间的数据.还有一个名为(btnsearch)的按钮和一个crystalreportviewer来显示报告.
我创建了一个名为View_Selling的视图,并将其用于水晶报表设计中.
我在btnsearch中写了这段代码:
I am using crystal report for my application to show the results of searchig.
in the main form i used four texboxes for filtering the data betwwen teo dates and two ides. and also one button named (btnsearch) and a crystalreportviewer to show the report.
i create a view named View_Selling and used it in crystal report design.
i wrote this code in the btnsearch :
private void btnSearch_Click(object sender, EventArgs e)
{
SqlDataAdapter adapt = new SqlDataAdapter();
adapt.SelectCommand = new SqlCommand();
adapt.SelectCommand.Connection = cnn;
adapt.SelectCommand.CommandType = CommandType.Text;
adapt.SelectCommand.CommandText = "SELECT * FROM View_Selling WHERE (khdate >=''" + txtFromCode.Text.Trim() + "'' AND khdate < ''" + txtToDate.Text.Trim() + "'') AND (id >=''" + txtFromCode.Text.Trim() + "'' AND id < ''" + txtToCode.Text.Trim() + "'') ";
DataSet dset = new DataSet();
cnn.Open();
***** adapt.Fill(dset, "View_Selling");
cnn.Close();
CrystalReport1 objRPT = new CrystalReport1();
objRPT.SetDataSource(dset);
crystalReportViewer1.ReportSource = objRPT;
}
但是当我执行应用程序时,它在*****行中显示此错误:
error:Invalid object name ''View_Selling''.
怎么了?
我无法解决问题!
帮帮我
谢谢alot
but when i execute the application ,it showes this error in line *****:
error:Invalid object name ''View_Selling''.
what''s wrong?
i cant solve the problem!!!
help me
thanks alot
推荐答案
检查要连接的数据库中是否存在View_Selling表.
Check if the table View_Selling exists in the database you are connecting to.
这篇关于搜寻有误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!