【问题标题】:What is the meaning of the symbol "@" Before A String Literal? [duplicate]字符串文字前的符号“@”是什么意思? [复制]
【发布时间】:2013-12-13 05:59:37
【问题描述】:

什么概念@来之前选这个代码?

SqlDataSource2.SelectCommand = @"SELECT tblstore.storname,tblproduct.pid, tblproduct.pname, tblproduct.pprice, tblproduct.publisher, tblproduct.writer FROM tblproduct INNER JOIN tblstore ON tblproduct.storeid = tblstore.storeid WHERE tblproduct.pname LIKE @likeText";
SqlDataSource2.SelectParameters.Add("likeText", "%" + txtName.Text + "%");

【问题讨论】:

标签: asp.net


【解决方案1】:

定义字符串字面量

string (C# Reference)

引用msdn

“逐字字符串的优点是不处理转义序列,这样写起来很容易,比如一个全限定文件名”

【讨论】:

    猜你喜欢
    • 2014-12-23
    • 2012-07-02
    • 2011-06-14
    • 2011-06-10
    • 2012-10-07
    • 2013-04-12
    • 1970-01-01
    相关资源
    最近更新 更多