How To Overcome Query Engine Error
-
i am using this code to print a report but the problem comes when i pass parameters like Supplier_Id as i have done in this query the error comes like "Query engine Error and follows with the path.I am using this code.Well the problem doesn't comes with the query in which i have not passed parameters Pls help me to sort out this problem.Thanks Fahad. try { int Supplier_Id=Convert.ToInt32(Supplier_Id_C.Text); string s_p="sp_P_S_Rpt"; SqlConnection conn = Class_Connection.Make_Conn(); // SqlCommand command = new SqlCommand(s_p, conn); // command.CommandType = CommandType.StoredProcedure; // command.Parameters.Add("@Supplier_Id", SqlDbType.Int); // command.Parameters["@Supplier_Id"].Value = Supplier_Id; // SqlDataAdapter adapter = new SqlDataAdapter(command); // DataSet ds = new DataSet(); // adapter.Fill(ds, "P_S"); // // dataGrid1.DataSource=ds; // dataGrid1.DataMember="P_S"; // P_R_Rpt obj = new P_R_Rpt(); // obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // obj.SetDataSource(ds); // crystalReportViewer1.ReportSource=obj; // Cursor = System.Windows.Forms.Cursors.Default; //reportDocument1.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // reportDocument1.SetDataSource(ds); // crystalReportViewer1.ReportSource = reportDocument1; // Finalized.P_R_Rpt obj = new P_R_Rpt(); // obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // reportDocument1.SetDataSource(ds); // crystalReportViewer1.ReportSource = reportDocument1; SqlCommand command = new SqlCommand(s_p, conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@Supplier_Id", SqlDbType.Int); command.Parameters["@Supplier_Id"].Value = Supplier_Id; SqlDataAdapter adapter = new SqlDataAdapter("SELECT dbo.Supplier.Supplier_Name, dbo.P_Order.P_O_Date, dbo.P_Order.P_O_Serial_No, dbo.P_Order.P_O_Id FROM dbo.P_Order INNER JOIN dbo.P_O_Details ON dbo.P_Order.P_O_Id = dbo.P_O_Details.P_O_Id INNER JOIN dbo.Supplier ON dbo.P_O_Details.Supplier_Id = dbo.Supplier.Supplier_Id WHERE(dbo.P_O_Details.Supplier_Id = 2)","Data Source=CDMA;Database=Final_Project1_e;UID=saASSWORD=sa");// = new SqlDataAdapter(command); //P_R ds = new P_R(); //SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet ds = new DataSet(); adapter.Fill(ds,"P_R_Rpt1"); dataGrid1.DataSource=ds; dataGrid1.DataMember = "P_R_Rpt1"; //P_R ds = new P_R(); // P_R_Rpt obj = new P_R_Rpt(); // obj.Load(); // obj.SetDataSource(ds); P_R_Rpt1 obj = new P_R_Rpt1(); obj.SetDataSource(ds); //obj.Load(); //sam
-
i am using this code to print a report but the problem comes when i pass parameters like Supplier_Id as i have done in this query the error comes like "Query engine Error and follows with the path.I am using this code.Well the problem doesn't comes with the query in which i have not passed parameters Pls help me to sort out this problem.Thanks Fahad. try { int Supplier_Id=Convert.ToInt32(Supplier_Id_C.Text); string s_p="sp_P_S_Rpt"; SqlConnection conn = Class_Connection.Make_Conn(); // SqlCommand command = new SqlCommand(s_p, conn); // command.CommandType = CommandType.StoredProcedure; // command.Parameters.Add("@Supplier_Id", SqlDbType.Int); // command.Parameters["@Supplier_Id"].Value = Supplier_Id; // SqlDataAdapter adapter = new SqlDataAdapter(command); // DataSet ds = new DataSet(); // adapter.Fill(ds, "P_S"); // // dataGrid1.DataSource=ds; // dataGrid1.DataMember="P_S"; // P_R_Rpt obj = new P_R_Rpt(); // obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // obj.SetDataSource(ds); // crystalReportViewer1.ReportSource=obj; // Cursor = System.Windows.Forms.Cursors.Default; //reportDocument1.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // reportDocument1.SetDataSource(ds); // crystalReportViewer1.ReportSource = reportDocument1; // Finalized.P_R_Rpt obj = new P_R_Rpt(); // obj.SetDatabaseLogon("sa","sa","CDMA","Final_Project1_e"); // reportDocument1.SetDataSource(ds); // crystalReportViewer1.ReportSource = reportDocument1; SqlCommand command = new SqlCommand(s_p, conn); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@Supplier_Id", SqlDbType.Int); command.Parameters["@Supplier_Id"].Value = Supplier_Id; SqlDataAdapter adapter = new SqlDataAdapter("SELECT dbo.Supplier.Supplier_Name, dbo.P_Order.P_O_Date, dbo.P_Order.P_O_Serial_No, dbo.P_Order.P_O_Id FROM dbo.P_Order INNER JOIN dbo.P_O_Details ON dbo.P_Order.P_O_Id = dbo.P_O_Details.P_O_Id INNER JOIN dbo.Supplier ON dbo.P_O_Details.Supplier_Id = dbo.Supplier.Supplier_Id WHERE(dbo.P_O_Details.Supplier_Id = 2)","Data Source=CDMA;Database=Final_Project1_e;UID=saASSWORD=sa");// = new SqlDataAdapter(command); //P_R ds = new P_R(); //SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet ds = new DataSet(); adapter.Fill(ds,"P_R_Rpt1"); dataGrid1.DataSource=ds; dataGrid1.DataMember = "P_R_Rpt1"; //P_R ds = new P_R(); // P_R_Rpt obj = new P_R_Rpt(); // obj.Load(); // obj.SetDataSource(ds); P_R_Rpt1 obj = new P_R_Rpt1(); obj.SetDataSource(ds); //obj.Load(); //sam