通過按下按鈕,我嘗試使用來自 SQL Server 的數據庫和其他表來更新 ASP.net 站點上的 GridView,但它沒有改變,沒有“捕獲”。GridView 不會出現。 { SqlConnection sqlConnection1; sqlConnection1 = new SqlConnection(@"Data Source=ELAD_HA\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True"); SqlCommand sqlCommand1; sqlCommand1 = new SqlCommand("SELECT * FROM TBUsers ORDER BY Name", sqlConnection1); try { DataSet ds = new DataSet(); SqlDataAdapter adptr = new SqlDataAdapter(sqlCommand1); SqlCommandBuilder comb = new SqlCommandBuilder(adptr); adptr.Fill(ds,"T1"); GridView2.DataSource = ds.Tables["T1"]; //GridView2.DataSource = ds; //GridView2.DataMember = "T1"; } catch (SqlException ex) { SuccessLabel1.Text = ex.Message.ToString(); } }代碼有什么問題嗎?PS我可以將數據源更改為我從菜單中選擇數據源的 GridView 嗎?(來自“分割”屏幕)。感謝各位的幫助。
添加回答
舉報
0/150
提交
取消