23-11-18, 01:03 PM
(آخر تعديل لهذه المشاركة : 23-11-18, 06:17 PM {2} بواسطة asemshahen5.)
كود :
Public Sub InsertNewRowIn_info(Lblid As Integer, Txtnom As String, Txttel As String, Txtwhats As String, Txtemail As String, Txtnotes As String)
Dim CmdInsert As New OleDb.OleDbCommand
With CmdInsert
.Connection = Con
.CommandType = CommandType.Text
.CommandText = "Insert Into info (id , nom , tel , whats , email , notes)values( @id , @nom , @tel , @whats , @email , @notes)"
.Parameters.Clear()
.Parameters.AddWithValue("@id", OleDbType.Integer).Value = Lblid
.Parameters.AddWithValue("@nom", OleDbType.VarChar).Value = Txtnom
.Parameters.AddWithValue("@tel", OleDbType.VarChar).Value = Txttel
.Parameters.AddWithValue("@whats", OleDbType.VarChar).Value = Txtwhats
.Parameters.AddWithValue("@email", OleDbType.VarChar).Value = Txtemail
.Parameters.AddWithValue("@notes", OleDbType.VarChar).Value = Txtnotes
End With
If con.State = ConnectionState.Closed Then con.Open()
CmdInsert.ExecuteNonQuery()
MsgBox("تم إضافة السجل بنجاح", MsgBoxStyle.Information, "حفظ")
CmdInsert = Nothing
End Subكود :
Public Sub InsertNewRowIn_info(Lblid As Integer, Txtnom As String, Txttel As String, Txtwhats As String, Txtemail As String, Txtnotes As String)
Dim CmdInsert As New OleDb.OleDbCommand
With CmdInsert
.Connection = con
.CommandType = CommandType.Text
.CommandText = "INSERT INTO info (id,nom,tel,whats,email,notes)VALUES(" & Lblid & ",'" & Txtnom & "','" & Txttel & "','" & Txtwhats & "','" & Txtemail & "','" & Txtnotes & "')"
End With
If con.State = ConnectionState.Closed Then con.Open()
CmdInsert.ExecuteNonQuery()
MsgBox("تم إضافة السجل بنجاح", MsgBoxStyle.Information, "حفظ")
CmdInsert = Nothing
End Subسبحان الله وبحمده سبحان الله العظيم و الحمد لله ولا اله الا الله والله اكبر
