1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Public Sub AddFieldsEQP(ByVal nserie As SqlInt32, ByVal marque As SqlString, ByVal modele As SqlString, ByVal designation As SqlString, ByVal valmin As SqlInt32, ByVal valmax As SqlInt32, ByVal dteacqui As SqlDateTime, ByVal dteMES As SqlDateTime, ByVal cdefrn As SqlInt32, ByVal drap As SqlString)
Dim query As String = "insert into DBMETROPTIM.dbo.NDS_METROPTIM_EQP values(" & nserie & ", '" & marque & "' ," & modele & ", '" & designation & "' ," & valmin & "," & valmax & ", '" & dteacqui & " ' , '" & dteMES & " ' ," & cdefrn & ", '" & drap & "')"
Try
Dim SqlCnx As SqlConnection = New SqlConnection("Server=(local)\SQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI")
Dim cmd As New SqlCommand(query, SqlCnx)
SqlCnx.Open()
cmd.ExecuteNonQuery()
SqlCnx.Close()
Catch sqlExc As SqlException
MessageBox.Show(sqlExc.ToString, "Erreur de SQL Server!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try |
Partager