本文介绍了添加用户输入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现这个
Console.WriteLine("Enter Name: "); this.name = Console.ReadLine(); string sql1 = "insert into items values ( " + this.name ")"; DataAccess.ExecuteSQL(sql1);当我尝试输入数据通过这一点,示值误差有关,unhanded例外,列名或号码不找到。
when I try to input data through this it showing error about , unhanded exception , column name or number not found.
我相信列名确定,我给它VARCHAR(50)类型。不允许这个方法?
I am sure column name is ok and I gave it varchar(50) type. Is this method not permitted?
感谢您提前。
推荐答案第一U忘了+和第二个名字听起来也许一个varchar / nvarchar的?不是不要忘了
First u forgot a + and second name sounds like maybe a varchar/nvarchar? than dont forget the ''
Console.WriteLine("Enter Name: "); this.name = Console.ReadLine(); string sql1 = "INSERT INTO tableName (columnName) VALUES ('" + this.name + "');" DataAccess.ExecuteSQL(sql1);更多推荐
添加用户输入数据库
发布评论