添加用户输入数据库

编程入门 行业动态 更新时间:2024-10-28 19:20:52
本文介绍了添加用户输入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想实现这个

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);

更多推荐

添加用户输入数据库

本文发布于:2023-10-26 07:56:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529557.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!