Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:08:39+00:00 2026-06-05T03:08:39+00:00

This goes to the genius out there let’s see if YOU can help me.

  • 0

This goes to the genius out there let’s see if YOU can help me.

Imports System
Imports System.Data

' Version 6.5.4.0 Runtime v2.0.50727
Imports MySql.Data.MySqlClient

Public Class MainForm

  ' Config - Main. 
  Private db_host As String = ""
  Private db_username As String = ""
  Private db_userpass As String = ""
  Private db_catalog As String = ""
  Private db_port As String = "3306"

  ' Config - Specific Table.
  Private db_specific_table As String = "SF6SETUP"

  ' Config - Other.
  Private DS As DataSet
  Private DA As MySqlDataAdapter
  Private BS As BindingSource

  ' ***
  '
  ' ***
  Private Sub My_Init()

    Dim conn As String = "Data Source = " & db_host & ";Initial Catalog=" & db_catalog & "; uid=" & db_username & ";password=" & db_userpass
    Dim myConnection As New MySqlConnection(conn)
    Dim cmd As String = "SELECT * FROM " & db_specific_table

    DA = New MySqlDataAdapter(cmd, myConnection)
    ' This line of code to generate update commands automatically.
    ' This update method of would not work without this line of code. 
    Dim MySQLCommandBuilder As New MySqlCommandBuilder(DA)

    myConnection.Open()

    DS = New DataSet()
    DA.Fill(DS, "MyTable")

    BS = New BindingSource
    BS.DataSource = DS.Tables(0)

    Dim BN As BindingNavigator = New BindingNavigator()
    BN.BindingSource = BS
    DataGridView.DataSource = BS

  End Sub

  ' ***
  '
  ' ***
  Private Sub MainForm_Load(sender As Object, e As System.EventArgs) Handles Me.Load

    My_Init()

  End Sub

  Private Sub DataGridView_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView.KeyPress
    BS.EndEdit()
    DA.Update(DS, "MyTable")
  End Sub
End Class

There is an error:

An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Data.dll

Additional information: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

This code works EXCEPT no changes saved to MySQLDatabase!!!
Please, help me solve this.

Thank you,

Mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:08:40+00:00Added an answer on June 5, 2026 at 3:08 am

    According to the error, your table does not have a primary key – how do you expect update to know which row to update (there could be duplicates).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope there is a php genius here somewhere who can help me with
This one goes round and round I know but I can't seem to find
Let's say I have a Libreoffice.org Calc (maybe this goes for MS Excel too)
#include <stdio.h> int main() { printf(This goes to screen\n); freopen(out.txt, a, stdout); printf(This goes
There was a previous question on StackOverflow about this subject (can insert the link,
I'm no code genius, but a fan of action script. Can you help me
I don't know what name this goes by and that's been complicating my search.
Hopefully this post goes better.. So I am stuck on this feature of this
Right, this code goes through a rather large multidimensional array (has about 28,000 rows
i have a small problem here which i cannot fix,This post goes through but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.