stored procedure urgent help required
dear all,
i am using crystal reports for vs.net 2002, infact i want to set my report datasource as dataset. i am using AddCommand to reterive required fields. problem is that when i set report data source as dataset it shows all those reocrds on report that are retrived by AddCommand not by my
here is my code
private DataSet myDs()
{
SqlConnection nwindConn = new SqlConnection("DataSource=localhost;Integrated Security=SSPI;Initial Catalog=testDB");
SqlCommand selectCMD = new SqlCommand("testPorcedure",nwindConn);
selectCMD.CommandType = CommandType.StoredProcedure;
selectCMD.CommandTimeout = 30;
SqlDataAdapter custDA = new SqlDataAdapter();
custDA.SelectCommand = selectCMD;
nwindConn.Open();
custDA.Fill(custDS);
nwindConn.Close();
return custDS;
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
this.ConnectionString();
CrystalReport1 oReport = new CrystalReport1();
oReport.SetDataSource(this.myDs());//dataset that is filled by my sp
crTableLogonInfos = new TableLogOnInfos();
crTableLogonInfo = new TableLogOnInfo();
crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = server;
crConnectionInfo.DatabaseName = database;
crConnectionInfo.UserID = user_id;
crConnectionInfo.Password = password;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTableLogonInfo.TableName = "Command";
crTableLogonInfos.Add(crTableLogonInfo);
CrystalReportViewer1.LogOnInfo = crTableLogonInfos;
CrystalReportViewer1.ReportSource = oReport;
CrystalReportViewer1.DataBind();
}
any body kindly help me i realy stuck
thanks in advance
|