[Vb.net] cree module de connexion?(sqlserver)
gezaakk
Messages postés
382
Date d'inscription
Statut
Membre
Dernière intervention
-
gezaakk Messages postés 382 Date d'inscription Statut Membre Dernière intervention -
gezaakk Messages postés 382 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Je voudrais créer un module qui permette d'automatiser la création d'une connexion vers mon SQLServer. Sans avoir a marquer en dur a chaque fois ma chaine de connexion dans le code.
Voici comment je me connecte a ma base sql server:
Dim MyConnexion As SqlConnection = New SqlConnection("Data Source=.\sqlexpress;" & _
"Integrated Security=SSPI;Initial Catalog=autoecole")
Dim Mycommand As SqlCommand = MyConnexion.CreateCommand()
Mycommand.CommandText = "SELECT * FROM utilisateur where typ_uti='" + Type.Text + "'"
MyConnexion.Open()
Dim myReader As SqlDataReader = Mycommand.ExecuteReader()
myReader.Read()
....
pass.Text = myReader.GetValue(2)
....
MyConnexion.Close()
Merci d'avance
Je voudrais créer un module qui permette d'automatiser la création d'une connexion vers mon SQLServer. Sans avoir a marquer en dur a chaque fois ma chaine de connexion dans le code.
Voici comment je me connecte a ma base sql server:
Dim MyConnexion As SqlConnection = New SqlConnection("Data Source=.\sqlexpress;" & _
"Integrated Security=SSPI;Initial Catalog=autoecole")
Dim Mycommand As SqlCommand = MyConnexion.CreateCommand()
Mycommand.CommandText = "SELECT * FROM utilisateur where typ_uti='" + Type.Text + "'"
MyConnexion.Open()
Dim myReader As SqlDataReader = Mycommand.ExecuteReader()
myReader.Read()
....
pass.Text = myReader.GetValue(2)
....
MyConnexion.Close()
Merci d'avance
A voir également:
- [Vb.net] cree module de connexion?(sqlserver)
- Gmail connexion - Guide
- Cree un compte google - Guide
- Connexion chromecast - Guide
- Cisco eap fast module - Forum Windows 8 / 8.1
- Cree gmail - Guide