|
|
|
Crystal Report, อยากรายงานไม่ได้ติด Error 'System.IO.FileNotFoundException' |
|
|
|
|
|
|
|
Code (C#)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace ProjectV2._0
{
public partial class testreport : Form
{
public testreport()
{
InitializeComponent();
}
private ManageSystemDBDataSet dsEx = new ManageSystemDBDataSet();
private string StrConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=managesystemdb.accdb;Persist Security Info=True;";
private OleDbConnection Connection;
private DataSet DataSt;
private OleDbCommand command;
private OleDbDataAdapter DataAdapter;
private DataTable dataTable;
private string Sql = "";
private void ConnectionDatabase()
{
Connection = new OleDbConnection();
if (Connection.State == ConnectionState.Open)
{
Connection.Close();
}
else
{
Connection.ConnectionString = StrConn;
Connection.Open();
}
}
private void testreport_Load(object sender, EventArgs e)
{
ConnectionDatabase();
}
private void button2_Click(object sender, EventArgs e)
{
try
{
if (dsEx.Asset.Rows.Count > 0)
{
dsEx.Asset.Rows.Clear();
}
for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
{
DataGridViewRow dr = null;
dr = dataGridView1.Rows[i];
dsEx.Asset.Rows.Add(dr.Cells[0].Value, dr.Cells[1].Value, dr.Cells[2].Value, dr.Cells[3].Value, dr.Cells[4].Value, dr.Cells[5].Value, dr.Cells[6].Value, dr.Cells[7].Value, dr.Cells[8].Value);
}
reportasset crv = new reportasset();
crv.SetDataSource(dsEx);
freportasset form = new freportasset();
form.report001.ReportSource = crv;
form.report001.Refresh();
form.ShowDialog();
}
catch
{
}
}
private void button1_Click(object sender, EventArgs e)
{
Sql = "select * from asset";
command = new OleDbCommand(Sql, Connection);
OleDbDataReader DataReader = command.ExecuteReader();
if (DataReader.HasRows)
{
dataTable = new DataTable();
dataTable.Load(DataReader);
dataGridView1.DataSource = dataTable;
DataReader.Close();
}
else
{
dataTable = new DataTable();
dataTable.Load(DataReader);
dataGridView1.DataSource = dataTable;
DataReader.Close();
}
}
}
}
Tag : .NET, Ms Access, Crystal Report, Win (Windows App), C#, Windows
|
|
|
|
|
|
Date :
2016-12-11 20:06:25 |
By :
snowman0020 |
View :
1148 |
Reply :
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รู็สึกจะมีปัญหาตัว Runtime ครับ ว่าแต่รายงานแสดงได้ปกติหรือเปล่าครับ
|
|
|
|
|
Date :
2016-12-13 13:17:27 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Very good!!
|
|
|
|
|
Date :
2016-12-14 11:22:15 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|