这个符号@是什么意思? System.Diagnostics.Process.Start(@"f:\461.doc")如题? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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 File.open(@"d:Files\subFile\file");相当于File.open("d:Files//subFile//file"); 防止转义,相当于("f:\\461.doc") 相当的好用, // 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); 存储过程在查询分析运行正常,在C#中为什么就会报错?这是为什么呢?请高人来帮帮。 什么是解源码 求一个比较好的数据访问类DBHelper mdi子窗体初始位置的一点问题 想做一个连数据库的软件,不过连接方式一直没有定下来,请教下用什么方式最好 最安全效率? 关于自定义事件的一个小问题 求一SQL语句???????????????????????????????????????? 急!!!急!!!关于DataGrid中隐藏列取值的问题!!高人请指点!! 求救(随机数) 求一正则取出Html里的值 C# 控件覆盖的问题 winform 怎么给特定结点添加checkbox结点
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
相当于File.open("d:Files//subFile//file");
// 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);