[英]Visual Studio 2005 error with Unicode
Dim findTheseVals(1) As Object
' Set the values of the keys to find.
Dim myDAgn As New SqlDataAdapter
findTheseVals(0) = pDivisionno
findTheseVals(1) = pGNe
sqlCon.Open()
Dim myDSGN As New DataSet
myDAgn.SelectCommand = New SqlCommand("SELECT * FROM Villages", sqlCon)
myDAgn.Fill(myDSGN, "Villages")
myPrimaryKey(0) = myDSGN.Tables("Villages").Columns("DivisionNo")
myPrimaryKey(1) = myDSGN.Tables("Villages").Columns("VillageSin")
myDSGN.Tables("Villages").PrimaryKey = myPrimaryKey
Dim myRow As DataRow
myRow = myDSGN.Tables("Villages").Rows.Find(findTheseVals)
If Not (myRow Is Nothing) Then
isExistsVi = True
VIid = myRow.Item("VillageID")
Else
isExistsVi = False
End If
sqlCon.Close()
pGNe是参数VillageSin是列并且包含UNICODE数据在编译时出现以下错误提示“这些列当前不具有唯一值”
如何从数据集中搜索unicode数据如何在c上更正
好像这条线
myDSGN.Tables("Villages").PrimaryKey = myPrimaryKey
是带有错误“这些列当前没有唯一值”的错误,因为您的数据违反了主键上的唯一要求。
这意味着您不能使用Find
。 这与SQL Server或Unicode数据无关。
而是摆脱myDSGN.Tables("Villages").PrimaryKey = myPrimaryKey
这一行myDSGN.Tables("Villages").PrimaryKey = myPrimaryKey
并使用.Select代替
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.