救命! ! ! ! CS1955非可调用成员'sqlconnection'不能像方法一样使用。 [英] HELP! ! ! ! CS1955 non-invocable member 'sqlconnection' cannot be used like a method.
问题描述
似乎无法理解这个错误,任何帮助都非常感激。
不可调用的成员'SqlConnection'不能像一个方法一样使用。以粗体突出显示。
protected void Page_Load(object sender,EventArgs e)
{
}
protected void btnSearch_Click(object sender,EventArgs e)
{
string connectionStr = ConfigurationManager.ConnectionStrings [connectionStr]。ConnectionString;
using(SqlConnection con = SqlConnection(connectionStr))
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText =spSearchEmployees;
cmd.CommandType = CommandType.StoredProcedure;
我尝试过:
似乎无法理解这个错误,任何帮助都非常感激。
不可调用的成员'SqlConnection'不能像一个方法一样使用。以粗体突出显示。
看起来代码缺少新关键字
使用(SqlConnection conn = new SqlConnection(connectionStr))
Cant seem to get my head around this error, any help greatly appreciated.
Non-invocable member 'SqlConnection' cannot be used like a method. Highlighted in Bold.
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSearch_Click(object sender, EventArgs e)
{
string connectionStr = ConfigurationManager.ConnectionStrings["connectionStr"].ConnectionString;
using (SqlConnection con = SqlConnection (connectionStr))
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "spSearchEmployees";
cmd.CommandType = CommandType.StoredProcedure;
What I have tried:
Cant seem to get my head around this error, any help greatly appreciated.
Non-invocable member 'SqlConnection' cannot be used like a method. Highlighted in Bold.
Look like the code is missing the "new" keyword
using (SqlConnection conn = new SqlConnection(connectionStr))
这篇关于救命! ! ! ! CS1955非可调用成员'sqlconnection'不能像方法一样使用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!