码迷,mamicode.com
首页 > 数据库 > 详细

在C#中使用SQL语句什么情况需要使用‘单引号’和“双引号”

时间:2018-03-01 00:47:57      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:nbsp   类型   pos   blog   单引号   class   color   value   string   

例如

string sql = "  insert into [Demo].[dbo].[textable] (姓名,身份证号)values (‘" + name.Text.ToString() + "‘," + number.Text.ToString() + ")";//执行在数据库表中增加一行姓名和身份证号

在表中已经设置成int类型的不需要再次添加‘单引号’,而字符串类型的数据需要进行添加‘单引号’。

 

在C#中使用SQL语句什么情况需要使用‘单引号’和“双引号”

标签:nbsp   类型   pos   blog   单引号   class   color   value   string   

原文地址:https://www.cnblogs.com/zoushiyu/p/8486300.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!