更新mysql数据未提交 [英] Update mysql data not submitting

查看:34
本文介绍了更新mysql数据未提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究一些可以编辑我的 mysql 数据库中的数据的工具 除了更新数据之外,其他一切都可以工作 说我通过程序编辑表 编辑它不会更新的条目的名称 这是我所拥有的到目前为止,如果有人可以提供帮助,将不胜感激.

i've been working on some tool that can edit data in my mysql database everything works other than the update data say i edit the table through the program edit the name of an entry it won't update this is what i have so far if anyone could help would be greatly appreciated thanks.

private void button4_Click(object sender, EventArgs e)
        {
            try

            {

                string MyConnection2 = "datasource=localhost;port=3306;username=root;password=toor";

                //Display query 

                string Query = "select * from truck.jobs;";

                MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);

                MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);



                //  MyConn2.Open(); 

                //For offline connection we weill use  MySqlDataAdapter class. 

                MySqlDataAdapter MyAdapter = new MySqlDataAdapter();

                MyAdapter.SelectCommand = MyCommand2;

                DataTable dTable = new DataTable();

                MyAdapter.Fill(dTable);





                dataGridView1.DataSource = dTable; // here i have assign dTable object to the dataGridView1 object to display data. 



                // MyConn2.Close(); 

            }

            catch (Exception ex)

            {



                MessageBox.Show(ex.Message);
            }
        }

数据库中当前使用的表是 id,Name,PlayerUID,JobsCompleted,MoneyEarned,CargoWeight,DrivenDistance我正在使用数据网格查看工具中的数据这是该工具的图像

the current tables being used in the database are id,Name,PlayerUID,JobsCompleted,MoneyEarned,CargoWeight,DrivenDistance i'm using a data grid to view the data in the tool here is an image of the tool

推荐答案

好的,我必须输入我想输入的数据的 id,这就是我遇到的问题

Ok i had to enter the id of which data i wanted to enter that's the issue i had

这篇关于更新mysql数据未提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆