Field data type in VB.net

  • Thread starter Thread starter Vanny
  • Start date Start date
V

Vanny

How can we find a Field data types from DataReader/Dataset/Datatable in
VB.net ??? For example code in VB6 where rstRecName is a recordset and j is
a column index:

If rstRecName.Fields(j).type = adLongVarChar Then
(do something)
end if

Thanks for your help

Vanny
 
Vanny said:
How can we find a Field data types from DataReader/Dataset/Datatable in
VB.net ??? For example code in VB6 where rstRecName is a recordset and j is
a column index:

If rstRecName.Fields(j).type = adLongVarChar Then
(do something)
end if

Thanks for your help

Vanny

Hi, Vanny

use: oDs.Tables["MyTable"].Columns[j].DataType.ToString();

Check this out too:
Mapping .NET Framework Data Provider Data Types to .NET Framework Data Types
http://msdn2.microsoft.com/en-us/library/4e5xt97a(vs.71).aspx

Regards,
Petar Atanasov
http://a-wake.net
 
Thanks Petar for your help

Petar Atanasov said:
Vanny said:
How can we find a Field data types from DataReader/Dataset/Datatable in
VB.net ??? For example code in VB6 where rstRecName is a recordset and j
is a column index:

If rstRecName.Fields(j).type = adLongVarChar Then
(do something)
end if

Thanks for your help

Vanny

Hi, Vanny

use: oDs.Tables["MyTable"].Columns[j].DataType.ToString();

Check this out too:
Mapping .NET Framework Data Provider Data Types to .NET Framework Data
Types
http://msdn2.microsoft.com/en-us/library/4e5xt97a(vs.71).aspx

Regards,
Petar Atanasov
http://a-wake.net
 
Back
Top