C#至少一个参数没有被指定值

来源:百度知道 编辑:UC知道 时间:2024/07/04 22:54:34
出错在oda.Fill(ds);

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string sqlp = "select * from province";
this.ddlProv.DataSource = DB.GetDS(sqlp);
this.ddlProv.DataTextField = "province";
this.ddlProv.DataValueField = "provinceID";
this.ddlProv.DataBind();
string sqlc = "select * from city where father=" + this.ddlProv.DataValueField;
this.ddlCity.DataSource = DB.GetDS(sqlc);
this.ddlCity.DataTextField = "city";
this.ddlCity.DataValueField = "cityID";
this.ddlCity.DataBind();
string sqla = "select * from area where father=" + this.ddlCity.DataValueField;
this.ddlArea.DataSource = DB.GetDS(sqla);
this.ddlArea.

sql查询语句,字符型参数需要加单引号限定!
WHERE P.[Ltype]='" + text + "' AND P.[DepID] ='" + u +"' ORDER BY InputTime DESC"
结尾的双引号不要丢!

是你某个方法的实参不对,少了实参或者是类型有问题
出错在oda.Fill(ds);如果ds是个dataset类,你就少加个名称
可以改成oda.Fill(ds, "表名");

是SQL语句有列名或表名写错了,检查下。

有空值,搂主在赋值前作一下检验就行了