我有一個方法,一個DLL:爲什麼我得到「沒有重載的方法需要兩個參數」?
public static DataSet ExecuteDataset(string strcommandText,CommandType commandType,SqlParameter[] p)
{
CreateConnection();
da = new SqlDataAdapter(strcommandText, con);
da.SelectCommand.CommandType = commandType;
da.SelectCommand.Parameters.AddRange(p);
ds = new DataSet();
da.Fill(ds);
return ds;
}
而且我已經在另一個DLL寫了一個方法:
public static DataSet GetDeptDetails()
{
string strcommandText = "sp_DeptDetails";
return SqlHelper.ExecuteDataset(strcommandText,CommandType.StoredProcedure);
}
在這裏,我得到這個錯誤:
no overload for method takes two arguments.
我究竟做錯了什麼?
那麼我可以看到第三個參數'SqlParameter [] p',你錯過了它們。 'ExecuteDataset'接受3個參數,並且沒有超載有2個參數 – V4Vendetta
SqlHelper.ExecuteDataset需要更多的兩個參數。 – Muctadir