วันศุกร์ที่ 20 พฤศจิกายน พ.ศ. 2558

ClaimIPD ERRORแก้อย่างไร

Server Error in '/' Application.

Object cannot be cast from DBNull to other types.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error: 


Line 183: olecmd.Parameters["@an"].Value = dr["an"].ToString();
Line 184: olecmd.Parameters["@hn"].Value = dr["hn"].ToString();
Line 185: olecmd.Parameters["@dateadm"].Value = Convert.ToDateTime(dr["dateadm"]);
Line 186: olecmd.Parameters["@timeadm"].Value = dr["timeadm"].ToString().Length==0?"0000":dr["timeadm"].ToString();
Line 187: olecmd.Parameters["@datedsc"].Value = Convert.ToDateTime(dr["datedsc"]);

Error ตัวนี้น่าจะเกิดจากบรรทัดเกินครับวิธีตรวจสอบ
1. นาเมาส์คลิกที่ช่อง A1
2. กดปุ่มที่คีย์บอร์ด Ctrl+Shift+End
จะเห็นว่ามีการเลือกคลุมข้อมูลเกินบรรทัดที่มีข้อมูลอยู่
วิธีแก้ไข
1. นำเมาส์คลิกที่ตัวเลขหน้าบรรทัดแรกที่เกินมา
2. กดปุ่ม Shift ค้างไว้แล้วนำเมาส์ไปคลิกที่ตัวเลขหน้าบรรทัด สุดท้ายหรือเกินออกไปจากบรรทัดที่เกินมา
3. นำเมาส์ไปคลิกขวาบริเวณที่ได้เลือกไว้ในข้อ1.-2. จะปรากฎเมนูขึ้นมาให้เลือก "ลบ" 
4. บันทึกแล้วนำไปส่งใหม่ครับ

ไม่มีความคิดเห็น:

แสดงความคิดเห็น