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 27
|
Public Sub setAgent(username As String, ByRef dataSetAgent As DataSet, idNext As Integer)
Dim sql As String = "INSERT INTO agents(id,num_agent,username, nom_agent,prenom_agent,mail,serv_local,commentaire,organisation,b_prod,b_plan,site) values (@id,'@numagent','@username','@nom','@prenom','@mail','@serv','@com','@orga',@bprod,@bplan,@site)"
Dim pgCommand As New NpgsqlCommand(sql, conPG)
pgCommand.Parameters.Add("@id", NpgsqlTypes.NpgsqlDbType.Integer)
pgCommand.Parameters.Add("@numagent", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@username", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@nom", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@prenom", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@mail", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@serv", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@com", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@orga", NpgsqlTypes.NpgsqlDbType.Varchar)
pgCommand.Parameters.Add("@bprod", NpgsqlTypes.NpgsqlDbType.Boolean)
pgCommand.Parameters.Add("@bplan", NpgsqlTypes.NpgsqlDbType.Boolean)
pgCommand.Parameters.Add("@site", NpgsqlTypes.NpgsqlDbType.Integer)
Dim Adaptateur As New NpgsqlDataAdapter(pgCommand)
Dim nvLigne As DataRow = dataSetAgent.Tables("agents").NewRow
nvLigne("id") = idNext
nvLigne("username") = username
dataSetAgent.Tables("agents").Rows.Add(nvLigne)
Adaptateur.Fill(dataSetAgent, "agents")
pgCommand = Nothing
End Sub |
Partager