C#里面sql语句前面加@符号是什么意思?具体怎么用的?

具体是怎么用的.
2024-11-07 05:46:38
推荐回答(3个)
回答1:

转义字符,用处还是很多的。比如
string a = "\\A";与string a = @"\A";就是一个意思,在传路径的时候,非常方便

回答2:

string strSQL = "SELECT * FROM HumanResources.Employee AS e"
+ " INNER JOIN Person.Contact AS c"
+ " ON e.ContactID = c.ContactID"
+ " ORDER BY c.LastName";

加上@符号后就可以直接换行了:

string strSQL = @"SELECT * FROM HumanResources.Employee AS e
INNER JOIN Person.Contact AS c

你这个例子中没必要用@啊

回答3:

我只知道加上@后,可以换行写,不加不能换行写