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
| Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim req As String
l = Val(TextBox1.Text)
c = Math.Round(((l - 147) / 2) + 0.5)
lv = Math.Round((c - 13))
h = Val(TextBox2.Text)
dx = Math.Round((h - 72))
hv = Math.Round((h - 174))
Dim cmd, cmd2 As New SqlCommand
Dim code As Integer
Dim list As New ListViewItem
list.Text = l
list.SubItems.Add(h)
list.SubItems.Add(c)
list.SubItems.Add(dx)
list.SubItems.Add(lv)
list.SubItems.Add(hv)
ListView1.Items.Add(list)
cn = New SqlConnection("Data Source=ADMIN\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=MET")
Try
cn.Open()
req = "SELECT code_chantier FROM chantier WHERE intitule = @ParamIntitule ;"
cmd2 = New SqlCommand(req, cn)
cmd2.Parameters.Add(New SqlParameter("@ParamIntitule", SqlDbType.VarChar, 20))
cmd2.Parameters("@ParamIntitule").Value = ComboBox1.SelectedItem
code = Convert.ToInt32(cmd2.ExecuteScalar)
'cmd = New SqlCommand("insert into drs_cls(code_chantier,larg,haut,pr,apv,lv,hv) values ('" & code & "','" & Val(TextBox2.Text) & "','" & Val(TextBox1.Text) & "','" & Val(TextBox4.Text) & "','" & Val(TextBox3.Text) & "','" & Val(TextBox6.Text) & "','" & Val(TextBox5.Text) & "');", cn)
'cmd.ExecuteNonQuery()
MsgBox("le code est:" & code)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub |
Partager