SQLException异常未处理的
本文关键字:未处理 异常 SQLException | 更新日期: 2023-09-27 18:15:36
我不知道我的代码有什么问题。当我运行它时,我得到了错误:用户代码未处理SqlException。类型为"System.Data.SqlClient"的异常。在System.Data.dll中发生了SqlException',但未在用户代码中处理
附加信息:无效的对象名称'ProductionPlanFabric'.
这是什么意思?
谢谢你:)
private void displayPendingFabric()
{
string strConn = ConfigurationManager.ConnectionStrings
["ZZFashionIMSConnectionString"].ToString();
SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand("SELECT ProductionPlanID, FashionStyleID, FabricID, WarehouseID, PPStatus, PPFabricReqd, PPFabricIssued FROM ProductionPlanFabric WHERE PPStatus = 0 OR PPStatus = 2", conn);
SqlDataAdapter daPPFabric = new SqlDataAdapter(cmd);
DataSet result = new DataSet();
conn.Open();
daPPFabric.Fill(result, "ProductionPlanFabric");
DataView dvPPFabric = result.Tables["ProductionPlanFabric"].DefaultView;
conn.Close();
gvPPFabric.DataSource = dvPPFabric;
gvPPFabric.DataBind();
}
试试下面的代码:
conn.Open();
daPPFabric.Fill(result);
DataView dvPPFabric = result.Tables[0].DefaultView;
conn.Close();