'Dans ta methode <System.Web.Services.WebMethod()> Public Function connexion(ByVal login As String, ByVal pass As String) As Personne Dim cnx As New SqlConnection cnx = New SqlConnection(ConfigurationManager.ConnectionStrings("testConnectionString").ConnectionString) cnx.Open() Dim cmd As New SqlCommand dim personne as new Personne() cmd.Connection = cnx cmd.CommandText = "SELECT nom, prenom FROM utilisateur WHERE login='" & login & "' AND pass='" & pass & "'" Dim dr As SqlDataReader dr = cmd.ExecuteReader If dr.HasRows Then dr.Read() personne.Nom = dr.Item("nom").ToString personne.Prenom = dr.Item("prenom").ToString Else retour.Nom = "saisie incorrecte" End If Return personne End Function 'dans une classe du meme namspace Public Class Personne Private _Nom As String Private _Prenom As String #Region "Liste Propriétés de la Classe" Public Property Nom() As String Get Return _Nom End Get Set(ByVal Value As String) _Nom = Value End Set End Property Public Property Nom() As String Get Return _Prenom End Get Set(ByVal Value As String) _Prenom = Value End Set End Property
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question