62,047
社区成员
发帖
与我相关
我的任务
分享
protected void Btnchaxun_Click(object sender, EventArgs e)
{
string thisConnectionString = @"Data Source=PIG-THINK\SQLEXPRESS;Initial Catalog=MESDATE;Integrated Security=True";
SqlConnection thisConnection = new SqlConnection(thisConnectionString);//设置Connection
SqlDataAdapter da = new SqlDataAdapter("sp_jqzt", thisConnection );
da.SelectCommand.CommandType = CommandType.StoredProcedure;
System.Data.DataSet thisDataSet = new System.Data.DataSet();//新建DataSet
SqlParameter par1 = new SqlParameter("@rectime1", this.TextBox1.Text);
SqlParameter par2 = new SqlParameter("@rectime2", this.TextBox2.Text);
da.SelectCommand.Parameters.AddRange(new SqlParameter[] { par1, par2, });
/* Put the stored procedure result into a dataset */
thisDataSet = SqlHelper.ExecuteDataset(thisConnection, "sp_Selectbb", par1 ,par2);
ReportDataSource datasource = new
ReportDataSource("MESDATEDataSet_bcgl_No90",
thisDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
if (thisDataSet.Tables[0].Rows.Count == 0)
{
Label2.Text = "Sorry, no products under this category!";
}
ReportViewer1.LocalReport.Refresh();
}