阅读258 返回首页    go 阿里云 go 技术社区[云栖]


Response.Redirect用法详解

    The Redirect method causes the browser to redirect the client to adifferent URL.

EG:

   string CurrentTime = DateTime.Now.ToShortDateString().ToString();

   //其中UserId是从函数外传递进去的参数,注意超链接需要添加引号,引号内的东西原样输出

   string MyUrl = "https://www.microsoft.com?UID=" + UserId + "&TYPE &APP&BIZ=" + CurrentTime + "&func=SYS0102";

   Response.Redirect(MyUrl);

小注:区别往sql语句中传递变量是这种形式'"+CurrentTime+"',而拼接字符串时变量" + CurrentTime + "其中CurrentTime前后的++表示连接,而+前或后的"是对其前后需要连接的字符串用的。

对数据库里面的SQL语句赋值的时候也要用在双引号里面SQL="select a,b,c from ..."

但是SQL语句中会有单引号把字段名引出来

例如:select * from table where user='abc';

这里的SQL语句可以直接写成SQL="select * from table where user='abc’"

ANSI/ISO标准规定字符数据的SQL常量要包含在单引号(')内。

最后更新:2017-04-03 12:54:15

  上一篇:go C# 结构(很少能用到)
  下一篇:go C# 选择排序