How can I check the data type of a field in the DataReader ?
- From: "fniles" <fniles@xxxxxxxxxx>
- Date: Tue, 22 May 2007 14:03:38 -0500
I am using VB.NET 2005 and SQLDataReader.
How can I check the data type of a field in the DataReader ? Thank you.
Dim cmdSQL As SqlClient.SqlCommand
Dim drSQL As SqlClient.SqlDataReader
sSQL = "select * from " & sTableName
cmdSQL = New SqlClient.SqlCommand
With cmdSQL
.Connection = m_Connection
.CommandText = sSQL
End With
drSQL = cmdSQL.ExecuteReader()
iFieldCnt = drSQL.FieldCount
Do While drSQL.Read
For x = 0 To iFieldCnt - 1
If drSQL.Item(x).GetType("system.string") Then ----> i want to
check of the data type of this column is string, how can I do that ?
Otherwise, how can I check the data type of this column ?
.
- Follow-Ups:
- Prev by Date: Re: Finding BindingSource.Position from Listbox Selection
- Next by Date: Re: Array mixed with integers and strings?
- Previous by thread: How to access a local drive (including removable drive) in a terminal server session programmatically?
- Next by thread: Re: How can I check the data type of a field in the DataReader ?
- Index(es):