الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

تعديل ال datasource بعد التعديل على ال dataset

مغلق
بدأه shayma'a في 9 سبتمبر 2003 · 1 رد · 1,094 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الاخوه الاعزاء في المنتدى

تواجهني مشكله هامه جدا في التالي:

-ما أفوم به هو باستخدام ال asp.net

انشاء web تقرأ من datasource بيانات في dataset من ثم اعدل واضيف والغي من هذه ال dataset

ثم انقل كل التغييرات مرة واحده الى datasource

i wrote this peace of code:

Dim DS As New DataSet()
    Dim DA As New SqlDataAdapter()
    Dim CONN As New SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind ")
    Dim CMDSELECT As New SqlCommand()
    Dim DROW As DataRow
    Dim DTABLE As DataTable

  CMDSELECT.Connection = CONN
   CMDSELECT.CommandText = " SELECT * FROM employees "
  DA.SelectCommand = CMDSELECT
        DA.Fill(DS, "Employees")
        DTABLE = DS.Tables("Employees")
        DROW = DTABLE.NewRow()
         DROW.Item(0) = 55
      .
      .
      .

        DTABLE.Rows.Add(DROW)

        Dim ADROW As DataRow() = DS.Tables("Employees").Select(Nothing, Nothing, DataViewRowState.Added)

        DA.Update(ADROW)

لكن يعطه هذا ال error

اقتباس
Update requires a valid InsertCommand when passed DataRow collection with new rows.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Update requires a valid InsertCommand when passed DataRow collection with new rows.

Source Error:

da.update(adrow)

pls i need help on that

تم تعديل هذه المشاركة بواسطة طارق إبراهيم في 14 نوفمبر 2004 في 00:06

#2

يا ريت توضحي المطلوب قبل طرح الكود فلربما أنتي استخدمتِ كود غير مناسب بالأصل ثم لو قمتي بتنسيق الكود فسيكون أفضل كي نستطيع قراءته..

You can fly while you can touch the sky

هذا الموضوع مغلق.

مواضيع مشابهة