「gvStoreInventry」上定義了DataSource和DataSourceID。刪除一個定義。 我無法檢測到錯誤。請幫助DataSource和DataSourceID都是在'gvStoreInventry'上定義的。刪除一個定義
protected void btnShowData_Click(object sender, EventArgs e)
{
string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmdShowData = new SqlCommand("SELECT * FROM tblStoreInventory", con);
con.Open();
gvStoreInventry.DataSource = cmdShowData.ExecuteReader();
gvStoreInventry.DataBind();
}
}