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
| Try
Dim dtA As New DateTime
dtA = Now
conv.ConnectionString = ("server=192.168.1.114;user ID=keunene1;Password=;database=garage")
conv.Open()
With cmdv
.Connection = conv
.CommandText = "INSERT INTO `garage`.`photo` ( `idph`,`lien`, `datelien`) " & _
"VALUES ( NULL,'" & TextBox1.Text & "','" & dtA.ToLongDateString & " à " & TimeOfDay & "');"
'in this line it Executes a transact-SQL statements against the connection and returns the number of rows affected
result = cmdv.ExecuteNonQuery
'if the result is equal to zero it means that no rows is inserted or somethings wrong during the execution
If result = 0 Then
MsgBox("Data has been Inserted!")
Else
MsgBox(" lien enregistrée pour " & TextBox1.Text, 64, "Contrôle entrée")
End If
End With
conv.Close()
Catch ex As Exception
MsgBox(ex)
End Try |
Partager