Some Doubt in retrieving PaRTIUCLAR pROJECT iD
I DESIGN A small application as follows;
Project ID Combobox1
Project Name Textbox1
Rate Textbox2
Unit Textbox3
Amt Textbox4
all the datas are stored in the database.
I have one textbox and one button(button name Project Wise Id)in textbox i type the letter R Only the project id start with R want to display the output as follows;
Project ID Project Name Rate Unit Amt
R001 Embedded 30 16 480
R002 Embedded 40 16 640
1120
Project ID Project Name Rate Unit Amt
P001 JAva 15 5 75
P002 .Net 20 10 200
R001 Embedded 30 16 480
R002 Embedded 40 16 640
Total 1395
private void button3_Click(object sender, EventArgs e)
{
con = new SqlConnection("Server=(local);initial catalog=master;Trusted_Connection=True");
con.Open();
string str = "select * from Project where PojectID like = '" + cb_id.SelectedItem + "'";
SqlCommand com = new SqlCommand(str, con);
SqlDataAdapter sqlda = new SqlDataAdapter(com);
DataSet ds = new DataSet();
sqlda.Fill(ds, "Project");
con.Close();
ReportDocument r1 = new ReportDocument();
//r1.Load("Full Path of Your Report\Employee.rpt");
//string path = Server.MapPath("Reports/Service Bill.rpt");
r1.Load("Reports/ProjectReport.rpt");
r1.SetDataSource(ds);
crystalReportViewer1.ReportSource = r1;
crystalReportViewer1.RefreshReport();
}
Here this query is Correct "select * from Project where PojectID like = '" + cb_id.SelectedItem + "'";
From the above please correct the query i have some doubt.