方法没有重载需要4个参数 [英] No overload for method take 4 arguments
问题描述
aspx.cs页面代码如下
aspx.cs page code as follows
private void BindFarmerList()
{
try
{
dt = new DataTable();
string originname = "";
if (Request.Cookies["SpiderUserLogin"].Value.ToString() == "SuperAdmin")
{
originname = drpOrigin.SelectedItem.Text.ToString().ToLower().Trim();
}
else
{
originname = Request.Cookies["SpiderOriginLogin"].Value.ToString();
}
originname = originname.Replace(" ", "");
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname, "", "farmerdata", "farmerctscode");
if (dt.Rows.Count > 0)
{
grdFarmerList.DataSource = dt;
grdFarmerList.DataBind();
grdFarmerList.HeaderRow.Cells[0].Attributes["data-class"] = "expand";
grdFarmerList.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";
grdFarmerList.HeaderRow.TableSection = TableRowSection.TableHeader;
}
else
{
grdFarmerList.DataSource = dt;
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "grdList();", false);
grdFarmerList.DataBind();
grdFarmerList.EmptyDataText = "No Farmers found in this origin...";
}
}
catch (Exception ex)
{
}
}
DAL.CS页面代码如下
DAL.CS page code as follows
public DataTable DAL_GetFarmerRegistration_ByOrigin_ApproverID(string originname, string approveheadid, string mastertype,string farmerctscode)
{
dataTable = new DataTable();
try
{
sqlConnection = new SqlConnection(connStr);
openConnection();
sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandText = "sp_get_farmerregistration_by_origin_approveheadid";
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Parameters.AddWithValue("@originname", originname);
sqlCommand.Parameters.AddWithValue("@approveheadid", approveheadid);
sqlCommand.Parameters.AddWithValue("@mastertype", mastertype);
sqlCommand.Parameters.AddWithValue("@farmerctscode", farmerctscode);
sqlDataAdapter = new SqlDataAdapter(sqlCommand);
sqlDataAdapter.Fill(dataTable);
}
catch (Exception ex)
{
}
return dataTable;
}
当我运行上面的代码时显示错误
DAL_GetFarmerRegistration_ByOrigin_ApproverID没有结束需要4个参数。
i传递下面一行的参数,但是这一行只显示错误
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname,,farmerdata,farmerctscode);
我尝试了什么:
aspx.cs页面代码如下
When i run the above code shows error
No over for DAL_GetFarmerRegistration_ByOrigin_ApproverID takes 4 arguments.
i pass the arguments in below line, but in this line only shows error
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname, "", "farmerdata", "farmerctscode");
What I have tried:
aspx.cs page code as follows
private void BindFarmerList()
{
try
{
dt = new DataTable();
string originname = "";
if (Request.Cookies["SpiderUserLogin"].Value.ToString() == "SuperAdmin")
{
originname = drpOrigin.SelectedItem.Text.ToString().ToLower().Trim();
}
else
{
originname = Request.Cookies["SpiderOriginLogin"].Value.ToString();
}
originname = originname.Replace(" ", "");
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname, "", "farmerdata", "farmerctscode");
if (dt.Rows.Count > 0)
{
grdFarmerList.DataSource = dt;
grdFarmerList.DataBind();
grdFarmerList.HeaderRow.Cells[0].Attributes["data-class"] = "expand";
grdFarmerList.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";
grdFarmerList.HeaderRow.TableSection = TableRowSection.TableHeader;
}
else
{
grdFarmerList.DataSource = dt;
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "grdList();", false);
grdFarmerList.DataBind();
grdFarmerList.EmptyDataText = "No Farmers found in this origin...";
}
}
catch (Exception ex)
{
}
}
DAL.CS页面代码如下
DAL.CS page code as follows
public DataTable DAL_GetFarmerRegistration_ByOrigin_ApproverID(string originname, string approveheadid, string mastertype,string farmerctscode)
{
dataTable = new DataTable();
try
{
sqlConnection = new SqlConnection(connStr);
openConnection();
sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandText = "sp_get_farmerregistration_by_origin_approveheadid";
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.Parameters.AddWithValue("@originname", originname);
sqlCommand.Parameters.AddWithValue("@approveheadid", approveheadid);
sqlCommand.Parameters.AddWithValue("@mastertype", mastertype);
sqlCommand.Parameters.AddWithValue("@farmerctscode", farmerctscode);
sqlDataAdapter = new SqlDataAdapter(sqlCommand);
sqlDataAdapter.Fill(dataTable);
}
catch (Exception ex)
{
}
return dataTable;
}
当我运行以上代码时显示错误
没有结束DAL_GetFarmerRegistration_ByOrigin_ApproverID需要4个参数。
i传递下面一行的参数,但是这一行只显示错误
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname,,farmerdata,farmerctscode);
When i run the above code shows error
No over for DAL_GetFarmerRegistration_ByOrigin_ApproverID takes 4 arguments.
i pass the arguments in below line, but in this line only shows error
dt = dal.DAL_GetFarmerRegistration_ByOrigin_ApproverID(originname, "", "farmerdata", "farmerctscode");
推荐答案
您最近是否更改了此代码?您似乎可能添加了一个参数并需要更新您的dll引用
Did you recently change this code? It seems likely that you added an argument and need to update your dll reference
这篇关于方法没有重载需要4个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!