using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Web;
namespace Database_Updation
{
class Program
{
static void Main(string[] args)
{
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDbConn1"].ToString());
SqlCommand cmd = new SqlCommand("SELECT [GUID] FROM [Source].[dbo].[Source_User]", cn);
cn.Open();
SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
rdr.Read();
Response.Write(rdr[0].ToString()); //read a value
}
}
}
我收到错误消息当前上下文中不存在名称“Response”
最佳答案
尝试使用
Console.Write(rdr[0].ToString()); //Write a value
代替
Response.Write(rdr[0].ToString()); //Write a value
希望对你有帮助
关于c# - 在响应中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14352417/