我正在开发一个视图页面。
这是我的代码:
int idses = Convert.ToInt32(Session["ID"].ToString());
// address
DataTable adrDT = new DataTable();
adrDT = ClassView.GetRows(idses);
houseN.Text = adrDT.Rows[0]["houseN"].ToString();
streetAD.Text = adrDT.Rows[0]["stAddress"].ToString();
townAD.Text = adrDT.Rows[0]["town"].ToString();
cityAD.Text = adrDT.Rows[0]["city"].ToString();
stateAD.Text = adrDT.Rows[0]["state"].ToString();
zipC.Text = adrDT.Rows[0]["zipCOde"].ToString();
ddlC.SelectedValue = adrDT.Rows[0]["countryID"].ToString();
teleNumb.Text = adrDT.Rows[0]["telephoneN"].ToString();
faxNumb.Text = adrDT.Rows[0]["faxN"].ToString();
这是我的数据层中的代码:
string rowSQL = "SELECT Merchant_Master.id, Merchant_Master.CompanyName, Merchant_Master.Url, Merchant_Master.AddressID, Industry.IndustryName, "
+ "Merchant_Master.IsActive, Merchant_Master.IsDeleted, Merchant_Master.DateCreated "
+ "FROM Merchant_Master JOIN Industry on Merchant_Master.IndustryID = Industry.id where Merchant_Master.id = @id";
//string rowSQL = "SELECT CompanyName, Url, DateCreated FROM Merchant_Master";
string[] param = {"@id"};
object[] paramVal = {};
return ClassDBQuery.ExecDataReader(rowSQL, param, paramVal);
我的问题是:如何在后面的代码中调用@id?
adrDT = ClassView.GetRows(idses);
- >在这一行...当我放置idses时,我得到错误“方法没有重载'GetRows()'接受一个参数”......我该怎么办?
答案 0 :(得分:0)
这意味着,在您的ClassView类中,您没有期望任何参数的GetRows方法。再看看你的ClassView。
编辑:
如果idses的类型是int,你应该这样做:
public static DataTable GetRows(int ideses) {...}