Question QUESTION: in my report 3 tables condition is there.but dataset separate condition is there.how to print runtime condition,means dataset condition.this is my coding.
CrystalReport2 obj = new CrystalReport2();
OdbcConnection con = new OdbcConnection(str);
OdbcDataAdapter da = new OdbcDataAdapter("SELECT distinct(Reserve_Group_Crm.Sno),Payment_Details1.Payee_Name,Reserve_Group_Crm.Group_Name,Room_Reserve.Room_Name,Room_Reserve.Room_No FROM (staff.dbo.Reserve_Group_Crm Reserve_Group_Crm INNER JOIN staff.dbo.Room_Reserve Room_Reserve ON Reserve_Group_Crm.Sno=Room_Reserve.SerialNo) INNER JOIN staff.dbo.Payment_Details1 Payment_Details1 ON Room_Reserve.SerialNo=Payment_Details1.SerialNo where reserve_group_crm.sno=2", con);
DataSet ds = new DataSet();
da.Fill(ds, "emp");
obj.SetDatabaseLogon("sa", "master");
obj.SetDataSource(ds.Tables["emp"]);
obj.PrintToPrinter(1, false, 0, 0);
if any modifictions.pls tell me.
i want print for particular record.not whole tables.how to do.
ANSWER: hi,
can you be more specific? i don't understand what you are trying to do...
If you add proper join you should get only selected record. May be show me exactly what is the result you are getting out of the tables.
-Srini
---------- FOLLOW-UP ----------
QUESTION: iam working in windows(c#).actually in my form one datagridview,and orint button is there.but datagridview 10 records is there.if i click second record.print only second record.not 10 record.how to do.
Answer hi
you should get some unique id, pass the ID to SQL to filter and pass that to dataset.
to explain better, store the serial number or some unique id in the datagrid and make visible false if you don't want to show, when click print button loop thru the grid and see which one selected item, get the unique id and pass that to SQL, which will return only one record.