A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Thursday, July 24, 2008

Input string was not in a correct format

  Dim dt As New DataTable()
        dt.Columns.Add("ReAssessment_ID", GetType(String))
        dt.Columns.Add("Result", GetType(String))
        dt.Columns.Add("Date", GetType(DateTime))
        dt.Columns.Add("Comp_ID", GetType(Integer))
        dt.Columns.Add("Status", GetType(String))
        dt.Columns.Add("ASummary_ID", GetType(Integer))
        dt.Columns.Add("Criteria_ID", GetType(Integer))

        For Each row As GridViewRow In GridView_assessment.Rows
            Dim dr As DataRow = dt.NewRow()
            dr("ReAssessment_ID") = row.Cells(0).Text
            dr("Result") = row.Cells(3).Text
            dr("Date") = row.Cells(5).Text
            dr("Comp_ID") = row.Cells(6).Text
            dr("Status") = row.Cells(7).Text
            dr("ASummary_ID") = row.Cells(8).Text
            dr("Criteria_ID") = row.Cells(9).Text
            dt.Rows.Add(dr)
        Next

 Why do i get a error "Input string was not in a correct format"  for [ dr("Comp_ID") = row.Cells(6).Text]?
Should i use this dt.Columns.Add("Comp_ID", GetType(Integer))?
the dataType for that column in the database is a int?



Source Click Here.

No comments:

Post a Comment

Post your comments here:

Originals Enjoy