Having problems with Int32 column
-
I am trying to put some info from the database and datatable into a data grid and I get an error on the phone number fields when trying to display the info in the dataGrid control. Here is the error I get. It says it can't store the info in the column. The type is Int 32, expecting Int32. In the database in this column I am using a bigint in sql server express 2005. Here is my code.
dt.Columns.Add(New DataColumn("Cell", GetType(Long)))
For Each row As DataRow In dtStud.Rows
dr(3) = row("stud\_phone") dt.Rows.Add(dr)
Next
'Dim dgView As New DataView(dt)
dgrStudList.DataSource = dtCan anyone tell me why it expects int32 when I am using a Long for the data table column.
-
I am trying to put some info from the database and datatable into a data grid and I get an error on the phone number fields when trying to display the info in the dataGrid control. Here is the error I get. It says it can't store the info in the column. The type is Int 32, expecting Int32. In the database in this column I am using a bigint in sql server express 2005. Here is my code.
dt.Columns.Add(New DataColumn("Cell", GetType(Long)))
For Each row As DataRow In dtStud.Rows
dr(3) = row("stud\_phone") dt.Rows.Add(dr)
Next
'Dim dgView As New DataView(dt)
dgrStudList.DataSource = dtCan anyone tell me why it expects int32 when I am using a Long for the data table column.
Where is dr created ? Are you sure that the row you're adding is the third row ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Where is dr created ? Are you sure that the row you're adding is the third row ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
here is my code.
Dim dt As New DataTable()
Dim dr As Data.DataRowFor Each row As DataRow In dtStud.Rows
dr = dt.NewRow()
dr(0) = row("stud_name")
dr(1) = row("stud_par_name")
dr(2) = row("stud_id")' get student instruments Call studentInstruments(Convert.ToInt32(row("stud\_id"))) ' create counter Dim intCount As Integer = 1 For Each row2 As DataRow In dtStudInst.Rows If intCount = 1 Then strInst = Convert.ToString(row2("less\_instrument")) Else strInst += ", " & Convert.ToString(row2("less\_instrument")) End If Next dr(3) = row("stud\_phone") dr(4) = row("stud\_cell") dr(5) = strInst dt.Rows.Add(dr) Next