Jump to content

Recommended Posts

Posted

Alguem tem um tipo de codigo para nao poder gravar com o mesmo nome, por exemplo se gravar um nome "Batista" e outro "batista" nao possa gravar! Preciso da vossa ajuda pessoal!

Arranjei este código mas não percebo la muito

Dim strsql As String = "Select  aviao_classe from aviao where aviao_classe like '" + TextBox4.Text + "%'"
                TextBox5.Text = RetornaValor(strsql)


                If TextBox5.Text = TextBox4.Text Then
                    MsgBox("Pack de viagens já adicionado", MsgBoxStyle.Exclamation, "Agência de viagens")
                    Exit Sub
                End If
Private Function RetornaValor(ByVal strSql) As String
        Try

            Dim db As New OleDbConnection(pap.My.Settings.ligacaodb)
            db.Open()
            Dim cmd As New OleDbCommand

            With cmd
                .Connection = db
                .CommandType = CommandType.Text
                .CommandText = strSql
                Return .ExecuteScalar()
            End With
            cmd.Dispose()
        Catch ex As OleDbException
            Return " "
        End Try


    End Function



Posted

Podes reduzir as strings a minúsculas, com a função toLower(), e aí já podes fazer uma comparação sem ter em conta se é frase está em minúsculas ou maiúsculas.

Nick antigo: softclean | Tens um projeto? | Wiki P@P

Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.