VB .net script task how to handle NULL values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apache626
    New Member
    • May 2010
    • 1

    VB .net script task how to handle NULL values

    I really need help with this one. I am using a script task to write data pulled from a MS SQL DB to a fixed width file. The script takes the ItemArray and writes the value of the column to the file using a streamwriter. The problem is when any of the DB values are NULL it throws off the fixed width. I'm not sure if I should try to handle this in the queries. If so, how should I make sure that if the value is NULL ,an empty string of the correct width is passed? Or should I handle it in the VB script with something like 'If not dbnull' but I'm not sure how to get the length the field is supposed to be from the array item.. If I am able to get the length how can I use that to write spaces or x's in place of actual data. I am new to this so I am stumped. Any help is greatly appreciated!
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Checking for DBNull would be the first step.
    I'm not sure how you would get the length of the field though....

    Comment

    Working...