VB.Net MySQL更新 [英] VB.Net MySQL updating

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

问题描述

大家好
我已经完成了一些MySQL连接

Hi guys
I have done some MySQL connection

MySQLConnection.ConnectionString = "server=127.0.0.1;Port=3307; User ID=root; password=qweqwe; database=test"

      MySQLConnection.Open()
      sql = "SELECT * FROM users where users.user = '" + TextBox1.Text + "';"

      da = New MySqlDataAdapter(sql, MySQLConnection)

      da.Fill(ds, "Mysql")
      MySQLConnection.Close()


但是之后我写


but after this when I write

da.Update(ds, "Mysql")


我收到一个错误在传递带有已修改行的DataRow集合时,更新需要有效的UpdateCommand."
您能帮我说一下我做错了吗,谢谢您:)


I get an error "Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
Can you help me and say what I am doing wrong thank you :)

推荐答案

[
Entering your error message in Google[^] yielded quit a few result.

The top few (this[^] on for example) suggest you check to see whether you have defined a primary key in the table you are using.


这篇关于VB.Net MySQL更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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