|
 |
|
C# ออกรายงานแล้วปรากฏว่าข้อมูลนั้นถูกเลือกมาโชว์ทั้งหมด ไม่ตรงตามเงื่อนไข |
|
 |
|
|
 |
 |
|
คือว่าจะออกรายงานที่เป็นใบเสร็จ แต่ปรากฏว่าทุกครั้งที่สั่งพิมพ์ จะเลือกข้อมูลแลกมาโชว์ ส่วน รายละเอียดการซื้อนั้นจะโช์วข้อมูลในฐานข้อมูลบรรทัดแรกจนบรรทัดสุดท้าย ช่วยดูโค๊ดให้หน่อยครับ Code (C#)
connect();
SqlCommand command = new SqlCommand("SELECT SaleOrder.SO_ID,SaleOrder.SO_Date,SaleOrder.OC_ID,Order_Customer.OC_Date,Customer.Cust_Name,Customer.Address,Customer.Tel,Employee.Emp_Name,SaleOrder.Total_Amount,Product.Product_Name,Product.Net_Weight,SaleOrder_Details.Quantity,SaleOrder_Details.Price,SaleOrder_Details.Unit_Name,SaleOrder_Details.Total_Amount FROM SaleOrder,SaleOrder_Details,Employee,Product,Customer,Order_Customer WHERE SaleOrder.SO_ID=SaleOrder_Details.SO_ID AND SaleOrder.Emp_ID=Employee.Emp_ID AND SaleOrder_Details.Product_ID=Product.Product_ID AND Order_Customer.Cust_ID=Customer.Cust_ID AND SaleOrder.OC_ID=Order_Customer.OC_ID AND SaleOrder.SO_ID=@SO_ID", con);
command.Parameters.AddWithValue("@SO_ID", so_id); //ลองดีบัคดู ค่าที่ส่งมานั้นตรง
DataSet ds = new DataSet();
command.CommandType = CommandType.Text;
da = new SqlDataAdapter(command);
ds.Tables.Clear();
da.Fill(ds, "report");
if (ds.Tables["report"].Rows.Count != 0)
{
R_SaleOrder rso = new R_SaleOrder();
rso.SetDataSource(ds.Tables["report"]);
rso.SetDatabaseLogon("", "1234", "", "");
//crystalReportViewer1.ParameterFieldInfo = pfields;
//rso.SetParameterValue("@SO_ID", so_id); // ที่ปิดคอมเม้นเพราะว่าชอบเออเร่อเกี่ยวกับ index
crystalReportViewer1.ReportSource = rso;
}
this.Cursor = Cursors.Default;
ShowDialog();
ช่วยดูด้วยครับ ขอบคุณครับ
Tag : .NET, Ms SQL Server 2008, Crystal Report, Win (Windows App), C#

|
|
 |
 |
 |
 |
Date :
2012-01-15 18:04:39 |
By :
อ่อนด๊อย |
View :
1489 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือว่าผมทดลองใส่ค่า SO_ID = 016 ดู แล้วลองไปยัดไว้ใน datagrid ปรากฎว่าโชว์ค่าถูกต้อง แต่เมื่อสั่งให้ไว้ในรายงาน กลับโชว์ข้อมูลรายการที่ 001 ตลอด ส่วนใน SaleOrder_Details นั้น โชว์ข้อมู,ทั้งหมดที่อยู่ในเบส และดูเหมือนข้อมูลจะซ้ำด้วย
|
 |
 |
 |
 |
Date :
2012-01-16 02:20:10 |
By :
อ่อนด๊อย |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยตอบหน่อยครับ
|
 |
 |
 |
 |
Date :
2012-01-16 15:40:42 |
By :
อ่อนด๊อย |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|