تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
حل مشكلة هذا الكود
#1
مرحبا بالاساتذة  
لدي مشكلة في كود الاضافة

هذا الكود يقوم بالاضافة الى قاعدة البيانات من نوع اكسس
ارجو ممن لديه القدرة مساعدتي في حل هذه المشكلة

=================================================
==================================================

Public Sub InsertNewRowIn_info(ByVal Lblid As Long,ByVal Txtnom As String,ByVal Txttel As String,ByVal Txtwhats As String,ByVal Txtemail As String,ByVal Txtnotes As String)
Dim CmdInsert As New 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 = 1 Then Con.Close()
Con.Open()
CmdInsert.ExecuteNonQuery()
Con.Close()
MsgBox("تم إضافة السجل بنجاح", MsgBoxStyle.Information, "حفظ")
CmdInsert = Nothing
End Sub


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة:
#2
كود :
   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
الرد }}}
تم الشكر بواسطة: imam_boune , elgokr
#3
شكرا يا استاذ asemshahen5

تم حل المشكلة

جزاك الله خيرا
الرد }}}
تم الشكر بواسطة: elgokr


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  مشكلة في ربط الفيجوال بيسك 2013 مع الاكسل صالح عبدالله 3 29 منذ 30 دقيقة مضت
آخر رد: صالح عبدالله
  مشكلة فى Radiobutton عند وضع صورة فيه أبو جودة 3 83 15-04-24, 04:31 AM
آخر رد: Taha Okla
  [سؤال] لدي مشكلة عند قراءة ملف نصي من خلال أداة RichBox , حيث تظهر لي علامات استفهام Mostchar 2 149 07-04-24, 02:51 PM
آخر رد: تركي الحلواني
  مشكلة في التايمر assuhimi 3 126 23-03-24, 04:51 PM
آخر رد: Taha Okla
  [سؤال] مشكلة اتصال مفتوح dell 2 172 12-03-24, 09:46 PM
آخر رد: dell
  مشكلة عند نقل البرنامج من فيجوال 2013 الى فيجوال 2017 strongriseman 5 156 12-03-24, 10:37 AM
آخر رد: strongriseman
  مشكلة فى جمع عمود فى داتا جريد فيو احمد خطاب 3 162 06-03-24, 07:49 PM
آخر رد: احمد خطاب
  ممكن حل المشكلة فى الكود التالي - من مشاركة استاذنا القدير / عبدالله الدوسري new_programer 4 176 02-03-24, 07:36 PM
آخر رد: new_programer
Photo [VB.NET] مشكلة في شكل الفورم abuyazan 5 305 27-02-24, 09:38 PM
آخر رد: aljzazy
  [VB.NET] مشكلة فى رفع الفاتورة asdfar1977 5 176 25-02-24, 02:04 PM
آخر رد: asdfar1977

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم