0
我在CrystalReport ASP.NET中遇到了一些麻煩。在ASP.NET中顯示Crystal Report Viewer
我在ASP.NET中創建一個DataSet
,我想用ADO.NET(xml)將它導出到CrystalReport.rpt
。但它失敗了。當我建立一個新連接並在報表中放置一個屬性列時,Crystal Report中的Main Report Viewer
顯示錯誤的結果。我在Oraclesqldevelop
編譯sql查詢,結果很好,沒有任何問題。我想點擊一個按鈕並顯示報告。
這是我的代碼:
protected void btnsumbit_Click(object sender, EventArgs e)
{
lblerror.Text = "";
if (txtdari.Text == "" || txtdari.Text == null || txtsampai.Text == "" || txtsampai.Text == null)
{
lblerror.Text = "Tanggal Harus Diisi !!!";
}
else
{
DateTime dt1 = Convert.ToDateTime(txtdari.Text);
DateTime dt2 = Convert.ToDateTime(txtsampai.Text);
if (dt1.Date > dt2.Date)
{
lblerror.Text = "Format Tanggal yang Dimasukkan Salah !!!";
}
else
{
OracleConnection conn = new OracleConnection();
conn.ConnectionString = connectionstring;
conn.Open();
string sql = "SELECT c.SUB_DISTRIBUTOR , c.MID , c.REKNO , b.ID, b.TERMINAL_ID , b.TANGGAL , b.KETERANGAN , b.DEBIT , b.KREDIT , b.SALDO , b.REFF_NO,b.PRODUK,b.NO_PELANGGAN, b.SN_ID , b.STATUS from MERCHANT c JOIN DAILY b ON (b.REKENING_NO = c.REKNO) where TANGGAL between TO_DATE('"+txtdari.Text+"','mm-dd-yyyy') AND TO_DATE('"+txtsampai.Text+"','mm-dd-yyyy')";
OracleCommand cmd = new OracleCommand(sql, conn);
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
da.Dispose();
DataSet ds = new DataSet();
ds.Tables.Add(dt);
ds.WriteXmlSchema("C:\\Users\\Henz\\Documents\\Visual Studio 2012\\Projects\\LPI\\LPI\\Files\\Sample.xml");
conn.Close();
Response.Redirect("plot.aspx");
}
}
}