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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| -----
'variable déclaration
'------------------------------
Dim objCommand As SqlCommand
Dim objParam As SqlParameter
Dim dt_KeywordsID As DataTable = New DataTable("detail_piece")
Dim dtc_KeywordsID As DataColumn
Dim myConnection As SqlConnection = New SqlConnection("data source=UC033\DEV;integrated security=SSPI;initial catalog=BUDGET2")
'-------------------------------------
' Create a connection to SQL Server
'-------------------------------------
objCommand = New SqlCommand("spd_detail_piece_insert", myConnection)
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Connection.Open()
'-------------------------------------
' Create parameters for sp
'-------------------------------------
objParam = objCommand.Parameters.Add("@id_nom_piece", SqlDbType.Int)
objParam.Value = lst_NomPiece.SelectedValue
objParam = objCommand.Parameters.Add("@id_profil", SqlDbType.Int)
objParam.Value = lst_profil.SelectedValue
objParam = objCommand.Parameters.Add("@id_contrat", SqlDbType.Int)
objParam.Value = lst_contrat.SelectedValue
objParam = objCommand.Parameters.Add("@id_projet", SqlDbType.Int)
objParam.Value = lst_projet.SelectedValue
objParam = objCommand.Parameters.Add("@num_piece", SqlDbType.Int)
objParam.Value = txt_NumPiece.Text
objParam = objCommand.Parameters.Add("@caracteristiques_imposees", SqlDbType.Bit)
objParam.Value = CheckBox1.Checked
objParam = objCommand.Parameters.Add("@nom_responsable", SqlDbType.VarChar)
objParam.Value = txt_NomResponsable.Text
objParam = objCommand.Parameters.Add("@date_livraison_souhaitee", SqlDbType.DateTime)
objParam.Value = txt_ConfirmationDateLivraison.Text
objParam = objCommand.Parameters.Add("@service_concerne", SqlDbType.VarChar)
objParam.Value = txt_ServiceConcerne.Text
objParam = objCommand.Parameters.Add("@contrat_existant", SqlDbType.Bit)
objParam.Value = CheckBox3.Checked
objParam = objCommand.Parameters.Add("@mission_forfait", SqlDbType.Bit)
objParam.Value = CheckBox5.Checked
objParam = objCommand.Parameters.Add("@paris_province", SqlDbType.VarChar)
objParam.Value = txt_pairs_province.Text
objParam = objCommand.Parameters.Add("@volume_estime_j_h", SqlDbType.Int)
objParam.Value = txt_Volume_j_h.Text
objParam = objCommand.Parameters.Add("@montant_astrainte", SqlDbType.Int)
objParam.Value = txt_astrainte.Text
objParam = objCommand.Parameters.Add("@montant_deplacement", SqlDbType.Int)
objParam.Value = txt_deplacement.Text
objParam = objCommand.Parameters.Add("@date_debut_prestation", SqlDbType.DateTime)
objParam.Value = txt_ConfirmationDateDeb.Text
objParam = objCommand.Parameters.Add("@date_fin_prestation", SqlDbType.DateTime)
objParam.Value = txt_ConfirmationDateFin.Text
objParam = objCommand.Parameters.Add("@TJM", SqlDbType.Int)
objParam.Value = txt_TJM.Text
'-------------------------------------
' Prepare table as parameter
'-------------------------------------
dtc_KeywordsID = New DataColumn()
dtc_KeywordsID.ColumnName = "id_detail_piece"
dt_KeywordsID.Columns.Add(dtc_KeywordsID)
'-------------------------------------
' Store procedure execution
'-------------------------------------
objCommand.ExecuteNonQuery()
'-------------------------------------
' Close the connexion object
'-------------------------------------
objCommand.Connection.Close()
'---------------------------
'message de confirmation
'---------------------------
Session("lblmessage") = "l'ajout est bien effectuer"
Response.Redirect("message.aspx")
end sub |
Partager