VB.NET代码需要解决方案

时间:2014-04-22 21:37:23

标签: .net vb.net

我想把所有的字符(全部!)示例:✭& 4kasdf'224584m~™¶ЫΔ█א龙龙Ѣ෴Ⅎɣ铑铑铑铑ẁ⒈محمدنهŹÉЏ 在BD ... for dat我在表格中使用UTF-8:

CREATE TABLE `clan` (
  `IdClan` varchar(3) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`IdClan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

但是当我想要问这个问题时,我的程序不起作用......该程序不会比较

Form1中:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim unGuildenIdent As New clsGuildenIdent
    Dim unClan As New clsClan
    unClan.IdClan = txttag.Text
    unClan = unGuildenIdent.darUnClan(txttag.Text)


End Sub

ClsClan

Public Class clsClan
    Private mIdClan As String
    Public Property IdClan() As String
        Get
            Return mIdClan
        End Get
        Set(ByVal value As String)
            mIdClan = value
        End Set
    End Property

    Public Function darUnClan(ByVal IdClan As String) As clsClan
        Dim unClan As New clsPClan
        Return unClan.darUnClan(IdClan)
    End Function
End Class

clsPClan

Public Function darUnClan(ByVal IdClan As String) As clsClan
    Dim unClan As New clsClan
    Dim sql As String
    sql = "SELECT Premium FROM clan WHERE IdClan='" & IdClan & "'"
    Dim resultados = ejecutarYdevolver(sql)
    If resultados.HasRows Then
        resultados.Read()
        unClan = crearClan(resultados)
    End If
    Return unClan
End Function

当我发送✭这个字符时,他们不给我Premium,但这个字符存在于BD中...我错了什么?

Thnx:)

1 个答案:

答案 0 :(得分:0)

在创建表的位置,将“IDClan”更改为NVarChar而不是VarChar