Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement