字段列表中的未知列 vb.net [英] Unknown column in field list vb.net
本文介绍了字段列表中的未知列 vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过vb.net连接到mysql
数据库
Connected to mysql
database with vb.net
当我想通过应用程序将数字添加到 Mysql
数据库时没有问题.
When i want to add number through application to Mysql
database no problems.
当我在字段中输入单词/字母时,它总是弹出字段列表"中的未知列文本"
When i type word/letter in field it always popups Unknown column 'text' in 'field list'
我检查了mysql
数据库中字段用户的类型设置为'Varchar' max 50
I checked the type in mysql
database of the field users it is set to 'Varchar' max 50
要添加记录,我使用查询
To add record i use query
query = "insert into table tableName (users,website,amount) values (" + txtname.Text + ",'" + txtsite.Text + "','" + txtamount.Text + "')"
推荐答案
并且您在
values(
用引号更正查询(并假设金额列可能是数字类型.如果它是非数字,您可以保持查询原样):
corrected query with quotes (and assumption that amount column could be of numeric type. If it is non-numeric you can keep the query as it is):
query = "insert into table tableName(users,website,amount) values ('" + txtname.Text + "','" + txtsite.Text + "','" + Convert.ToDecimal(txtamount.Text) + "')" // or Convert.ToInt64 whichever it could be
这篇关于字段列表中的未知列 vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文