Batista15 Posted April 20, 2009 at 01:40 PM Report #257753 Posted April 20, 2009 at 01:40 PM 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
softklin Posted April 20, 2009 at 02:50 PM Report #257769 Posted April 20, 2009 at 02:50 PM 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.
Dotinho Posted April 20, 2009 at 02:55 PM Report #257770 Posted April 20, 2009 at 02:55 PM ou podes usar a funçao InString, assim podes compara texto com texto de forma que ele nao liga a maiusculas ou inusculas, o texto é igual.. Luis Lourenço
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now