Vb.net 将数字字符串转换为sqldbtype

Vb.net 将数字字符串转换为sqldbtype,vb.net,Vb.net,不为数字工作。我想知道如何处理这些数据类型。提前感谢。SqlDbType枚举不包含值“numeric”,因此无法将此类字符串强制转换到该枚举 为了避免错误,请使用以下代码:(C#,不熟悉VB.NET抱歉) SQL Server数据库提供程序的所有可用数据类型包括: Dim MyType as String = "float" 而且它应该可以工作,因为OleDbType确实包含“Numeric”。您能告诉我哪些数据类型的定义在SqlDbType enum中不存在。不是真的,我只能告诉它们存在什么

不为数字工作。我想知道如何处理这些数据类型。提前感谢。

SqlDbType枚举不包含值“numeric”,因此无法将此类字符串强制转换到该枚举

为了避免错误,请使用以下代码:(C#,不熟悉VB.NET抱歉)

SQL Server数据库提供程序的所有可用数据类型包括:

Dim MyType as String = "float"

而且它应该可以工作,因为
OleDbType
确实包含“Numeric”。

您能告诉我哪些数据类型的定义在SqlDbType enum中不存在。不是真的,我只能告诉它们存在什么。不管怎样,看看我的编辑我想我找到了你问题的根源。
SqlDbType dbType;
if (Enum.TryParse<SqlDbType>(myType, true, out dbType))
{
    MessageBox.Show("type: " + dbType);
}
else
{
    MessageBox.Show("invalid type: " + myType);
}
Dim MyType as String = "float"
BigInt Binary Bit Char DateTime Decimal Float Image Int Money NChar NText NVarChar Real UniqueIdentifier SmallDateTime SmallInt SmallMoney Text Timestamp TinyInt VarBinary VarChar Variant Xml Udt Structured Date Time DateTime2 DateTimeOffset
Dim sdtype As OleDbType  sdtype = DirectCast([Enum].Parse(GetType(OleDbType), MyType), OleDbType)