Figure 73D Creating Command Parameters with VBNET

oCmd.Parameters.Add("@FName", SqlDbType.VarChar, 50).Value = FName

Do not confuse the SqlDbTypes enumeration in the System.Data namespace with the System.Data.SqlTypes namespace.The SqlDbTypes enumeration is useful for specifying the data type of a parameter that belongs to a Command object.The classes in System.Data.SqlTypes are used for declaring variables.

The SqlDbType and the System.Data.SQLTypes may sound the same, but they are very different in nature and in use. Refer to Table 7.1 for the mapping from native SQL Server data types to the types provided in System.Data.SqlTypes and to the SqlDbTypes enumeration.

0 0

Post a comment