alexa-tracking

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/52dd0be4c0cb1702558b457c/ask-error-output-crystal-report
~ask~ Error Output Crystal report
Gan ane coba buat report pake crystall report dari 2 tabel ko error yah?
Spoiler for error:

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace StokBarang
{
class lapRelation
{

public static void laporan(string query, string query2)
{
SqlConnection conn = Koneksi.Conn;
try
{
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(query, conn);
SqlDataAdapter sda2 = new SqlDataAdapter(query2, conn);
DataSet ds = new DataSet();
sda.Fill(ds, "MsUser");
sda2.Fill(ds, "MsBarang");

relation myReport = new relation();
myReport.Database.Tables[0].SetDataSource(ds);

relationForm fr = new relationForm();
fr.crystalReportViewer1.ReportSource = myReport;
fr.Show();


}
catch (SqlException ex)
{
MessageBox.Show(ex.Message, "error");
}
finally
{
conn.Close();
}
}
}
}

Spoiler for DataSet:

Spoiler for Button Untuk Show Report:

Buat master2 yang tau solusinya, mohon bantuannya emoticon-Matabelo
Quote:Original Posted By joxze
Gan ane coba buat report pake crystall report dari 2 tabel ko error yah?
Spoiler for error:

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace StokBarang
{
class lapRelation
{

public static void laporan(string query, string query2)
{
SqlConnection conn = Koneksi.Conn;
try
{
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(query, conn);
SqlDataAdapter sda2 = new SqlDataAdapter(query2, conn);
DataSet ds = new DataSet();
sda.Fill(ds, "MsUser");
sda2.Fill(ds, "MsBarang");

relation myReport = new relation();
myReport.Database.Tables[0].SetDataSource(ds);

relationForm fr = new relationForm();
fr.crystalReportViewer1.ReportSource = myReport;
fr.Show();


}
catch (SqlException ex)
{
MessageBox.Show(ex.Message, "error");
}
finally
{
conn.Close();
}
}
}
}

Spoiler for DataSet:

Spoiler for Button Untuk Show Report:

Buat master2 yang tau solusinya, mohon bantuannya emoticon-Matabelo