Results 1 to 15 of 15

Thread: [RESOLVED] Visual Studio 2005 - Modifying/Deleting Row in the table

Threaded View

  1. #1

    Thread Starter
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Resolved [RESOLVED] Visual Studio 2005 - Modifying/Deleting Row in the table

    Hi

    I am getting an error while updating a table after modifications...

    Can anyone see what exactly is the problem. It gives an error message

    "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." at the place indicated below...

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            'opening databse
            Dim Con As New OleDb.OleDbConnection
    
            Con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Srout\Desktop\Reviews\Reviews\Reviews\table\Review.mdb;Persist Security Info=True;Jet OLEDB:Database Password=magicword"
    
            Con.Open()
    
            Dim ds As New DataSet
            Dim da As OleDb.OleDbDataAdapter
            Dim sql As String
    
            sql = "SELECT EmpId, FullNm, RepsTo, MgcWrd, Levell, Statuss, Desg FROM Review"
            da = New OleDb.OleDbDataAdapter(sql, Con)
    
            da.Fill(ds, "Review")
    
            Dim cb As New OleDb.OleDbCommandBuilder(da)
    
            'Checkrw is the row where the data has to be inserted. It give me a value betwenn 0 and 8
            'as required. i am okay with the value of checkrw.
            'MsgBox(checkrw)
            ds.Tables("Review").Rows(checkrw).Item(0) = Trim(TextBox1.Text) 'Emp ID
            ds.Tables("Review").Rows(checkrw).Item(1) = Trim(TextBox2.Text) 'FullNm
            ds.Tables("Review").Rows(checkrw).Item(2) = Trim(ComboBox1.Text) 'RepsTo
            ds.Tables("Review").Rows(checkrw).Item(3) = "CHANGEME" 'MgcWrd
            ds.Tables("Review").Rows(checkrw).Item(4) = Mid(Trim(ComboBox2.Text), 7, 1) 'Levell
    
            If RadioButton1.Checked = True Then
                ds.Tables("Review").Rows(checkrw).Item(5) = "Active" 'Status
            Else
                ds.Tables("Review").Rows(checkrw).Item(5) = "InActive" 'Status
            End If
    
            ds.Tables("Review").Rows(checkrw).Item(6) = Trim(ComboBox3.Text) 'Desc
    
            da.Update(ds, "Review") '<===== ERROR HERE....
    
            MsgBox("User Details have been modified Successfuly")
            Con.Close()
            Me.Close()
        End Sub
    Last edited by Siddharth Rout; Feb 27th, 2007 at 11:18 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width