F
fniles
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 ?
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 ?