本文介绍了使用文本框从vb.net重命名mysql表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个简单的程序来从vb.net创建一个mysql表并通过用户选择重命名。

i在创建表时取得了成功这很简单,但是如何重命名表来自textbox折磨了我很多。

这里是创建表的代码

 试试 
cnn.Open()
Dim query As 字符串
query = CREATE TABLE best.new(id INT NOT NULL,名称VARCHAR(45)NULL,日期DATETIME NULL,PRIMARY KEY(id));

cmd = MySqlCommand(query,cnn)
reader = cmd.ExecuteReader
MessageBox.Show( table创建
cnn.Close()





i尝试使用此代码重命名但没有成功。 ...!已经实现了

i尝试了一些,但它给出了错误

i想要从用户给出的id重命名

  Dim 重命名作为 字符串 
Rename =( RENAME TABLE new to TextBox1.Text)
cmd = MySqlCommand(重命名,cnn)
reader = cmd.ExecuteReader
MessageBox.Show( 重命名为
cnn.Close()





请帮我找出来

解决方案




i am making a simple program to create a mysql table from vb.net and renaming it by user choice.
i got success in creating the table it is quite simple but how to rename a table from textbox tortured me a lot.
here's the code to create a table

Try
 cnn.Open()
 Dim query As String
 query = "CREATE TABLE best.new (id INT NOT NULL,  name VARCHAR(45) NULL, date DATETIME NULL,   PRIMARY KEY (id));"

 cmd = New MySqlCommand(query, cnn)
 reader = cmd.ExecuteReader
 MessageBox.Show("table created")
 cnn.Close()



i tried to rename it using this code but no success....! achieved yet
i tried few more but it gives error
i want to rename it from the "id" given by the user

Dim rename As String
 Rename = ("RENAME TABLE new To" TextBox1.Text)
 cmd = New MySqlCommand(Rename, cnn)
 reader = cmd.ExecuteReader
 MessageBox.Show("renamed")
 cnn.Close()



please help me to find it out

解决方案




这篇关于使用文本框从vb.net重命名mysql表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 13:08