我正在编写一个程序,从一封邮件发送数据库中的多封用户邮件,但我得到一个错误
对象引用未设置为对象的示例。
下面是连接到db的代码。
SqlCommand cmd = null;
// Error occurs on the line below
string connectionString = (ConfigurationManager.ConnectionStrings["SchedulingInterviewsConnectionString"].ConnectionString);
string queryString = @"SELECT Email FROM interview WHERE Email = Email";
using (SqlConnection connection =
new SqlConnection(connectionString))
{
SqlCommand command =
new SqlCommand(queryString, connection);
connection.Open();
cmd = new SqlCommand(queryString);
cmd.Connection = connection;
SqlDataReader reader = cmd.ExecuteReader
1条答案
按热度按时间ijxebb2r1#
您可以按如下方式进行检查:(configurationmanager.connectionstrings[“schedulinginterviewsconnectionstring”]=null
您需要添加'schedulinginterviewsconnectionstring'的connectionstring