You are on page 1of 2

Imports Imports Imports Imports Imports

System.Web System.Web.Services System.Web.Services.Protocols System.Data System.Data.SqlClient

******************************************************************************** ******************************** Module ModuleBDDMysql Dim connexion As SqlConnection Dim commande As SqlCommand Public Sub connecter() connexion = New SqlConnection connexion.ConnectionString = "Data Source=medaymen-pc\sqlexpress; DataBa se=db; Integrated Security=True;Pooling=False" connexion.Open() End Sub Public Sub envoyerRequete(ByVal commando As String) commande = connexion.CreateCommand commande.CommandText = commando commande.CommandTimeout = 10 commande.ExecuteNonQuery() End Sub Public Sub deconnecter() connexion.Close() End Sub End Module ******************************************************************************** ******************************* ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomm ent the following line. ' <System.Web.Script.Services.ScriptService()> _ <WebService(Namespace:="http://tempuri.org/")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Public Class WebService Inherits System.Web.Services.WebService ******************************************************************************** ******************************* <WebMethod()> _ Public Function HelloWorld() As String Return "Hello World" End Function

<WebMethod()> _ Public Function ajouter(ByVal cin As Integer, ByVal nom As String, ByVal pre nom As String, ByVal date_n As String, ByVal tel As Integer, ByVal solde As Inte ger, ByVal date_op As String, ByVal rip As Integer) As Integer

connecter() ModuleBDDMysql.envoyerRequete("INSERT INTO Client (cin,nom,prenom,date_n ,tel,solde,date_op,rip) VALUES(" & cin & ",'" & nom & "' ,'" & prenom & "','" & date_n & "'," & tel & "," & solde & ",'" & date_op & "'," & rip & ")") deconnecter() Return 0 End Function

End Class

Dim cmd As New SqlCommand Dim connexion As New SqlConnection connexion.ConnectionString = "Data Source=.\SQLEXPRESS; Integrated Secur ity=True; User Instance=True" connexion.Open()

You might also like