W
WindyD
Guest
Hi
Im developing a windows form application using visual studio 2010. There I have used microsoft reporting to generate reports. I have designed the reports and there I have specified some text boxes inorder to display and print data from the database the data should retrieved to those text boxes according to the primary key typed in a textbox(textBox1) in the form where the report viewer of that particular .rdlc file. there when user give the value to the text box(i.e. BHT ) and click the view report button, the report should refresh and display the data relavent to that BHT this what I typed as the code in the form. Im new to this and cant understant what to do. Please help.... Thanks.
private void button1_Click(object sender, EventArgs e)
{
SqlConnection myconnection = new SqlConnection("user=sa;" + "password=123;" + "server=USER-PC\\SQLEXPRESS;" + "Trusted_Connection=Yes;" + "database=Hematology;" + "Connection timeout=30;");
myconnection.Open();
SqlCommand report = new SqlCommand("Select * FROM Patient p, BMarrow b WHERE p.BHT=b.BHT="+textBox1.Text+";", myconnection);
SqlDataReader reader = report.ExecuteReader();
if (reader != null)
{
if (reader.Read())
{
//i want to send the selected data into the text boxes in the .rdlc report.
//this form has reportviewer 1 and report1.rdlc is the report viewd in that report viewer
/*I have created 3 datasets under report data and dataset1 stands for the Patient table and datase2
stands for the BMarrow table from those two daasets I have dragged and dropped the attributes
into the text boxes in report1.rdlc*/
}
}
}
Continue reading...
Im developing a windows form application using visual studio 2010. There I have used microsoft reporting to generate reports. I have designed the reports and there I have specified some text boxes inorder to display and print data from the database the data should retrieved to those text boxes according to the primary key typed in a textbox(textBox1) in the form where the report viewer of that particular .rdlc file. there when user give the value to the text box(i.e. BHT ) and click the view report button, the report should refresh and display the data relavent to that BHT this what I typed as the code in the form. Im new to this and cant understant what to do. Please help.... Thanks.
private void button1_Click(object sender, EventArgs e)
{
SqlConnection myconnection = new SqlConnection("user=sa;" + "password=123;" + "server=USER-PC\\SQLEXPRESS;" + "Trusted_Connection=Yes;" + "database=Hematology;" + "Connection timeout=30;");
myconnection.Open();
SqlCommand report = new SqlCommand("Select * FROM Patient p, BMarrow b WHERE p.BHT=b.BHT="+textBox1.Text+";", myconnection);
SqlDataReader reader = report.ExecuteReader();
if (reader != null)
{
if (reader.Read())
{
//i want to send the selected data into the text boxes in the .rdlc report.
//this form has reportviewer 1 and report1.rdlc is the report viewd in that report viewer
/*I have created 3 datasets under report data and dataset1 stands for the Patient table and datase2
stands for the BMarrow table from those two daasets I have dragged and dropped the attributes
into the text boxes in report1.rdlc*/
}
}
}
Continue reading...