输入" GUID"没有定义

时间:2011-11-14 12:59:17

标签: vb.net

我在这行代码上遇到了这个错误:

 cmd.Parameters.Add("@address2", SqlDbType.VarChar).Value = IIf(Address2.Trim.Length > 0,Address2, DBNull.Value)
  

未定义“GUID”类型。

     

名称IIf和DBNull未声明

如何解决这个问题?

Private Shared Function Update(ByVal ID As <b>Guid</b>, ByVal Name As String, ByVal Address1 As String, ByVal Address2 As String, ByVal City As String, ByVal State As String, ByVal Zip As String) As Integer
    Dim cn As New SqlConnection(sqlConn)
    cn.Open()
    Dim sb As New StringBuilder
    With sb
        .Append("Update Vendor ")
        .Append("set ")
        .Append("vendor_name = @name, ")


  Public Class Vendor
  Inherits BaseClass
#Region " Local Variables"
   Protected _id As Guid

1 个答案:

答案 0 :(得分:1)

您可能需要使用完全限定名称System.Guid。 e.g。

ByVal ID As System.Guid

或尝试导入System命名空间,也会捕获DBNull,也可能是IIf。