Partie Identification Login,PassWord avec SQL Server
Bonjour, J'ai un problème avec la partie d’identification elle affiche je site
Citation:
Expression de type non booléen spécifiée dans un contexte ou une condition est attendue ,prés de 'de'
voici le code que j'ai confectionner pour le Bouton (Se Connecter) de ma form
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As OleDb.OleDbConnection
conn = New OleDb.OleDbConnection(ChaineConnection)
Try
conn.Open()
Dim cmd As OleDb.OleDbCommand
cmd = New OleDb.OleDbCommand
cmd.CommandText = "SELECT count(*) from Code Utilisateur where Identifiant='" & txt_ID.Text & "' and Mot de Passe='" & txt_MPass.Text & "'"
cmd.Connection = conn
Dim i As String = cmd.ExecuteScalar
If i = "0" Then
MsgBox("Unknown Username and Password")
txt_ID.Text = ""
txt_MPass.Text = ""
Else
Accueil.Text = "GPAO-MARQUARDT-SAEE" & " " & Me.txt_ID.Text
Accueil.Show()
Accueil.Enabled = True
TIM_TM.Enabled = True
Button1.Enabled = True
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub |
ma chaîne de connections fonctionne très bien
Code:
1 2 3 4 5 6 7
| Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic
Module Connexion
Public ChaineConnection As String = "provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=true;Initial Catalog=**** *********;Data Source=HP-PC\XY;"
End Module |
Si vous pouvez m aider pour exécuter ce code je serai reconnaissant,,merci d’avance........
Code:
1 2 3 4 5 6 7
| Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic
Module Connexion
Public ChaineConnection As String = "provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=true;Initial Catalog=GPAO SAEE/MARQUARDT;Data Source=HP-PC\XY;"
End Module |