zoukankan
html css js c++ java
C#中 @ 的用法
using
System.Data.SqlClient;
using
System.Data;
using
System;
class
MyClass
{
void
Test()
{
//
1 加在字符串前面,字符串中的 \ 失去转义符的作用,直接写字符串而不需要考虑转义字符
string
path
=
@"
C:\Windows\
"
;
//
如果不加 @,编译会提示无法识别的转义序列
//
如果不加 @,可以写成如下
string
path2
=
"
C:\\Windows\\
"
;
//
2 加在字符串前面,字符串中的 " 要用 "" 表示
string
str
=
@"
aaa=""bbb""
"
;
//
不加 @,可以写成
string
str2
=
"
aaa=\
"
bbb\
""
;
//
3 加在字符串前面,换行空格都保存着,方便阅读代码
string
insert
=
@"
insert into Users
(
UserID,
Username,
Email
) values
(
@UserID,
@Username,
@Email
)
"
;
//
4 用关键字做变量时在关键字前面加@
string
@operator
=
"
+
"
;
string
@class
=
"
分类一
"
;
Console.WriteLine(@operator);
Console.WriteLine(@class);
//
5 作为sql语句里的一个“标签”,声明此处需要插入一个参数
string
delete
=
"
delete from Categery where CategoryID=@CategoryID
"
;
SqlConnection connection
=
new
SqlConnection(
"
connectionString
"
);
SqlCommand command
=
new
SqlCommand(delete, connection);
command.Parameters.Add(
"
@CategoryID
"
, SqlDbType.BigInt);
}
//
Test()
}
//
class MyClass
查看全文
相关阅读:
jQuery找出所有没有disabled属性的checkbox
jQuery prop()方法
Aliyun 中PHP如何升级
The connection to the server localhost:8080 was refused
ks8集群扩容新增节点,以及xshell无法访问的问题
设置小程序模板消息keyword_id_list问题
git如何新建仓库,并初始化代码
k8s应用配置详解
git如何把分支变成master
nginx首页根据IP跳转
原文地址:https://www.cnblogs.com/yangbin1005/p/1171581.html
最新文章
oracle学习总结
php环境搭建
jvm性能调优
cas单点登录搭建
01 数据库sql
03 js事件循环
02 js原型链
01 js数据类型
20190905启航篇
js003-4方向8方向函数
热门文章
js002---- 标准内置对象
js001 ---- async
Vue 路由对象
使用jQuery改变css中有important的样式
jQuery添加插入元素技巧
清除及关闭Firefox的缓存
Vue项目中返回上一页
前端Excel表格导入 并传给后端
时间戳与日期互转
jQuery中查找带有某一属性的元素
Copyright © 2011-2022 走看看