Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used title no. as primary key.
When I am executing this code on SqlManagement Studio it displays the correct data but in Crystal report it repeats data multiple time.

This Is My Code,
VB
Cursor = Cursors.WaitCursor;
              timer1.Enabled = true;
              RptAccSubject rpt = new RptAccSubject();
              frmr_AccSub frm = new frmr_AccSub();
              //The report you created.
              SqlConnection myConnection = default(SqlConnection);
              SqlCommand MyCommand = new SqlCommand();
              SqlDataAdapter myDA = new SqlDataAdapter();
              lib_dbDataSet myDS = new lib_dbDataSet();
              //The DataSet you created.

              myConnection = new SqlConnection(cs);
              MyCommand.Connection = myConnection;

              MyCommand.CommandText = "Select B.TittleName,B.ClassNo,B.Author1,B.NameOfPublsher,B.Subject,I.TotalPages,I.VenderSource,I.OrderNo,I.OrderDate,I.InvoiceBillNo,I.InvoiceBillDt,I.PriceInRs,I.PurPrice,I.Remark,A.AccNo From BookTittle B FULL OUTER JOIN Invoice I on B.TittleNo=I.TittleNo JOIN AccessionRegister A on B.TittleNo=A.TittleNo where A.AccNo between @d1 and @d2 and A.SeriesCode = '" + cmbSeriesCode.Text + "' ";
              MyCommand.Parameters.Add("@d1", SqlDbType.Int, 30, "AccNo").Value = textFromAccNo.Text;
              MyCommand.Parameters.Add("@d2", SqlDbType.Int, 30, "AccNo").Value = textToAccNo.Text;
              MyCommand.CommandType = CommandType.Text;
              myDA.SelectCommand = MyCommand;
              myDA.Fill(myDS, "BookTittle");
              myDA.Fill(myDS, "AccessionRegister");
              myDA.Fill(myDS, "Invoice");

              rpt.SetDataSource(myDS);

              frm.crystalReportViewer1.ReportSource = rpt;
              frm.Show();
Posted
Updated 9-Sep-15 5:35am
v3
Comments
Maciej Los 9-Sep-15 11:37am    
Debug the programme to find out what recordset MyCommand returns.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900