none
Erro: Incorrect syntax near '='. RRS feed

  • Pergunta

  • Boa tarde,

    Quando tento executar essa funcção

    Function Mostra_usuario(ByVal nome As String) As Boolean
            Dim usuario As New DataTable
            Dim Strcon As String
            Strcon = "Data source=.\UBERCONTA;AttachDbFilename=C:\Arquivos de programas\Microsoft SQL Server\MSSQL10.UBERCONTA\MSSQL\DATA\simples.mdf;Integrated Security=True;User Instance=True"
            Dim con As New SqlConnection(Strcon)
            Dim Sql = New SqlCommand("SELECT codigo, nome, senha from usuario WHERE codigo=" + txtUsuario.Text)

            Try
                con.Open()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

            sql.Connection = con
            Dim Dr As SqlDataReader = Sql.ExecuteReader

            While Dr.Read
                txtNome.Text = Dr.GetString(0).ToString()
            End While
            Return 1
            Exit Function
        End Function

    Dá o seguinte Erro:   Incorrect syntax near '='.   

    segunda-feira, 7 de janeiro de 2013 17:15

Respostas