General information
Category:
The Mere Mortals .NET Framework
Title:
Data type of empty datarow column???
Does anyone know how to obtain the datatype of a value in an empty datarow? I have an empty dataset which was created by a call to GetDataSet() that returned no rows. However there should still be schema information in the dataset. I am trying to iterate across the columnn collection to extract this information like this:
.
.
Dim dc As DataColumn
Dim dt As DataTable
Dim dr As DataRow
dt = dsMyDataSet.Tables(0)
dr = dt.NewRow
For Each dc In dt.Columns
ColumnName = dc.ColumnName.ToString()
Debug.WriteLine(ColumnName + " is " + dr(ColumnName).GetType.ToString)
Next
This code writes out "System.DBNull" for each column. I can't use Row(0) of the datatable because it doesn't exist.
Does anyone know the easy solution to this?
Thanks,
Max Fillmore
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only