Re: How can I check the data type of a field in the DataReader ?
- From: "fniles" <fniles@xxxxxxxxxx>
- Date: Tue, 22 May 2007 15:40:47 -0500
Now, I seem not to be able to find how to find a data type of a field in a
DataSet.
Dim aRow As DataRow()
m_cmdSQL = New SqlClient.SqlCommand
With m_cmdSQL
.Connection = adoCon
.CommandText = sSQL
End With
m_daSQL = New SqlClient.SqlDataAdapter
m_dsSQL = New DataSet
m_daSQL.SelectCommand = m_cmdSQL
m_daSQL.Fill(m_dsSQL)
for arow in m_dsSQL.Tables(0).rows
--> How do you find the data type of column 1, 2, etc ?
"fniles" <fniles@xxxxxxxxxx> wrote in message
news:OnztqPKnHHA.4628@xxxxxxxxxxxxxxxxxxxxxxx
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 ?
.
- References:
- Prev by Date: Table adapters vs. Data adapters
- Next by Date: Single Quote issue
- Previous by thread: Re: How can I check the data type of a field in the DataReader ?
- Next by thread: Table adapters vs. Data adapters
- Index(es):
Relevant Pages
|