Results 1 to 15 of 15

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

  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

  2. #2

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

    Re: Visual Studio 2005 - Modifying the table

    Also while deleting i am getting the same error?

    Here is the code...

    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)
    
            ds.Tables("Review").Rows(checkrw).Delete()
    
            da.Update(ds, "Review") '<===== ERROR HERE
            MsgBox("User Details have been erased Successfuly")
            Con.Close()
            Me.Close()
        End Sub
    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

  3. #3
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    Quote Originally Posted by koolsid
    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
    You are not calling OleDbCommandBuilder.GetUpdateCommand() to generate the correct command.
    "The dark side clouds everything. Impossible to see the future is."

  4. #4
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Visual Studio 2005 - Modifying the table

    Quote Originally Posted by koolsid
    Also while deleting i am getting the same error?

    Here is the code...

    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)
    
            ds.Tables("Review").Rows(checkrw).Delete()
    
            da.Update(ds, "Review") '<===== ERROR HERE
            MsgBox("User Details have been erased Successfuly")
            Con.Close()
            Me.Close()
        End Sub
    You are NOT calling OleDBCommandBuilder.GetDeleteCommand()
    "The dark side clouds everything. Impossible to see the future is."

  5. #5

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    You are not calling OleDbCommandBuilder.GetUpdateCommand() to generate the correct command
    Thanks Asgorath for the reply....

    I am sorry, I am just trying my hand with VS 2005.

    Can you explain or give an example of what you mean?
    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

  6. #6
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    See if this works ok... Update Row
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. 'opening databse
    3. Dim Con As New OleDb.OleDbConnection
    4. 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"
    5. Con.Open()
    6. Dim ds As New DataSet
    7. Dim da As OleDb.OleDbDataAdapter
    8. Dim sql As String
    9. sql = "SELECT EmpId, FullNm, RepsTo, MgcWrd, Levell, Statuss, Desg FROM Review"
    10. da = New OleDb.OleDbDataAdapter(sql, Con)
    11. da.Fill(ds, "Review")
    12. Dim cb As New OleDb.OleDbCommandBuilder(da)
    13. '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.
    14. 'MsgBox(checkrw)
    15. ds.Tables("Review").Rows(checkrw).Item(0) = Trim(TextBox1.Text) 'Emp ID
    16. ds.Tables("Review").Rows(checkrw).Item(1) = Trim(TextBox2.Text) 'FullNm
    17. ds.Tables("Review").Rows(checkrw).Item(2) = Trim(ComboBox1.Text) 'RepsTo
    18. ds.Tables("Review").Rows(checkrw).Item(3) = "CHANGEME" 'MgcWrd
    19. ds.Tables("Review").Rows(checkrw).Item(4) = Mid(Trim(ComboBox2.Text), 7, 1) 'Levell
    20. If RadioButton1.Checked = True Then
    21.     ds.Tables("Review").Rows(checkrw).Item(5) = "Active" 'Status
    22. Else
    23.     ds.Tables("Review").Rows(checkrw).Item(5) = "InActive" 'Status
    24. End If
    25. ds.Tables("Review").Rows(checkrw).Item(6) = Trim(ComboBox3.Text) 'Desc
    26.  
    27. da.UpdateCommand = cb.GetUpdateCommand()
    28. MessageBox.Show(da.UpdateCommand.CommandText)
    29. da.Update(ds, "Review") '<===== ERROR HERE....
    30. MsgBox("User Details have been modified Successfuly")
    31. Con.Close()
    32. Me.Close()
    33. End Sub
    "The dark side clouds everything. Impossible to see the future is."

  7. #7

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    Hi Asgorath

    I get the same error but now at these lines respectively...

    Code:
    da.UpdateCommand = cb.GetUpdateCommand() 'in the update sub
    
    'and
    
    da.UpdateCommand = cb.GetDeleteCommand() 'in the delete sub
    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

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    You're not supposed to call GetDeleteCommand, GetInsertCommand or GetUpdateCommand. The CommandBuilder generates the required commands implicitluy when and as needed. The only reason to calls those methods explicitly is if you want to make come changes to the Command objects they create, like enlisting them in a transaction. If you don't need to make any changes then DO NOT call those methods.

    The problem is that your SelectCommand doesn't return any primary key information. The CommandBuilder needs a way to uniquely identify each record in order to generate the appropriate SQL statements. Without a primary key it can't do that. Change the MissingSchemaAction property of your DataAdapter from the default Add to AddWithKey.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    The problem is that your SelectCommand doesn't return any primary key information. The CommandBuilder needs a way to uniquely identify each record in order to generate the appropriate SQL statements. Without a primary key it can't do that. Change the MissingSchemaAction property of your DataAdapter from the default Add to AddWithKey.
    What would I do without you????????

    What does this mean? "Change the MissingSchemaAction property of your DataAdapter from the default Add to AddWithKey."
    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

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    If I said "Change the Text property of your TextBox from the default empty string to 'Hello World'" what would you do?

    The MissingSchemaAction property defines the action taken by the DataAdapter when it encounters missing schema information in the target DataTable. Add means that when you call Fill it will add any missing schema information, i.e. columns, to the target DataTable. If you change it to AddWithKey then it will, as the name suggests, add primary key information too, thus allowing your CommandBuilder to generate SQL code that uniquely identifies each record as required.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    If I said "Change the Text property of your TextBox from the default empty string to 'Hello World'" what would you do?

    The MissingSchemaAction property defines the action taken by the DataAdapter when it encounters missing schema information in the target DataTable. Add means that when you call Fill it will add any missing schema information, i.e. columns, to the target DataTable. If you change it to AddWithKey then it will, as the name suggests, add primary key information too, thus allowing your CommandBuilder to generate SQL code that uniquely identifies each record as required.
    Hi I am very new to the concept of DataAdapters [4 days old ]. Had it been Vb6, I wouldn't have had a problem in doing what I wanted....

    The link(home & learn) which you had given me did a wonderful job of explaining everything to me but it didn't talk about 'DataAdapters' as an object which i could Right Click and change the property like i can do in textboxes.... could you please in layman terms explain what you said above above....

    Has it got something to do with "da.Fill(ds, "Review")"?

    Hope you will be patient with me and treat me like an absolute noob in VS 2005.

    Looking forward for your full support
    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

  12. #12
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    Forget the fact that it's a DataAdapter. Setting a property is a universal concept. An object is an object and a property is a property. If you want to set the value of any property for any object you just type:
    Code:
    VariableName.PropertyName = Value
    You know the name of your variable and you know the name of your property. Intellisense will give you the value because its an enumeration. Just start typing.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  13. #13

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    Oh you mean
    as in code. I was looking for an object. ...sorry... but i am learning fast...

    so i need to add

    da.MissingSchemaAction = MissingSchemaAction.AddWithKey

    before

    da.Update(ds, "Review")

    Is that correct? Er, I don't have a primary key in my database. Is that necessary? if yes where do i mention that in the above code?

    Thnx
    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

  14. #14
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    If you don't have a primary key then how can you distinguish one record from another? There are times when it is appropriate to have a table without a primary key but they are very, very much in the minority. If this is one of those times then you can't use a CommandBuilder, plain and simple. The fact that you are trying to use a CommandBuilder at all suggests to me that this isn't one of those times though. How can you update or delete a record if you cannot uniquely identify it?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  15. #15

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

    Re: Visual Studio 2005 - Modifying/Deleting Row in the table

    Quote Originally Posted by jmcilhinney
    If you don't have a primary key then how can you distinguish one record from another? There are times when it is appropriate to have a table without a primary key but they are very, very much in the minority. If this is one of those times then you can't use a CommandBuilder, plain and simple. The fact that you are trying to use a CommandBuilder at all suggests to me that this isn't one of those times though. How can you update or delete a record if you cannot uniquely identify it?
    Hmmm. I created a primary key even though I didn't need it and now it works fine

    jmcilhinney, I appreciate your patience....

    [edit]: It says that I need to spread some reputations but I will remember this and I will come back and rate your post. It's a promise. I owe you two reps now
    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