Importing text data to SQL numeric field

  • Using VB 2005.net (which I am new at), I reading a delimited text file, editing some of the values, and populating a SQL table.  I am having an issue when the columns of the SQL table are numeric. VB is forcing me to use a decimal format, even though the field is defined as numeric(9,2) in SQL. 

    A snippet of the code;

    Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("c:\file.txt")

    MyReader.TextFieldType = FileIO.FieldType.Delimited

    MyReader.SetDelimiters(

    "|")

    Dim currentRow As String()

    While Not MyReader.EndOfData

    currentRow = MyReader.ReadFields()

    'Code to manipulate data

    Me

    .BhLoadTableAdapter1.Insert _

    (

    CType

    (currentRow(32), Global.System.Nullable(Of Decimal)))

    End While

    (The Ctype code is generated by VB because it is insisting on type decimal.)

    I've even tried casting the data.

    Can someone point me in the right direction?

  • numeric type in SQL server is the same as decimal, what's the problem?

  • The problem I am experiencing, is if the value is 100.00 or more I receive the following error, Parameter value '100.00' is out of range.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply