TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
yoann069
NA
1
0
Error Conditions
Mar 18 2004 5:19 PM
I'm running an application that translates data and moves it to a SQL table via stored procedure. The issue is not that the exception is being handled, it's that it's handling it too well and stopping the import from occuring because values don't meet what I suspect is system based format values .. This is a partial of the process and where the exception takes place: sqCommand.Parameters.Add"@FILLER",m_stInvRec.FILLER); sqCommand.Parameters.Add("@PDHS_EFT_POST_DATE",m_stInvRec.PDHS_EFT_POST_DATE); sqCommand.Parameters.Add("@PDHS_CHK_EFT_TRAD_REL_ID",m_stInvRec.PDHS_CHK_EFT_TRAD_REL_ID); sqCommand.Parameters.Add("@FILLER2",m_stInvRec.FILLER2); try { sqCommand.ExecuteNonQuery(); } catch (Exception e) { Console.WriteLine(e.ToString()); } sqConnect.Close(); return true; } public bool WriteErrorRecord(StreamWriter swFile, int iRecordNo, byte[] bInput) { swFile.WriteLine(String.Format("Record no {0} is in error, record follows.", iRecordNo)); swFile.WriteLine(String.Format("(Blank or zero fields indicate possible erroneous value)", iRecordNo)); if (m_stInvRec.PDHS_CODE == "P") { swFile.WriteLine("PDHS_CODE =" + m_stInvRec.PDHS_CODE); swFile.WriteLine("PDHS_VNDR_NUM =" + m_stInvRec.PDHS_VNDR_NUM); It works because I get this in an error file: Record no 1 is in error, record follows. (Blank or zero fields indicate possible erroneous value) PDHS_CODE =T PDHS_VNDR_NUM =0000000 PDHS_VNDR_DEPT =0000 PDHS_INV_NUM =000000000000000 PDHS_INV_CHK_NUM =0 PDHS_INV_CHK_DATE =20303 PDHS_INV_CHK_AMT =0 PDHS_INV_DATE =0 Unfortunately, the values 0 and null are acceptable for the output file and should be loaded to SQL as such .. how do I get around this so it doesn't treat it as an exception and foregoes the output to a text file but still imports to SQL? Thanks .. I'm no guru and would appreciate any help ..
Reply
Answers (
0
)
Reditrect Window?
How to convert a string into an array of bit ?