看板 Visual_Basic 關於我們 聯絡資訊
這是我的程式碼 cnn.Open() Try 'cnn.Open() Dim employee_data As New SqlCommand("select * from store") Dim employee_adapter As New SqlDataAdapter employee_adapter.SelectCommand = employee_data employee_adapter.SelectCommand.Connection = cnn Dim employee_set As DataSet employee_adapter.Fill(employee_set, "store") DataGrid1.DataSource = employee_set DataGrid1.DataMember = employee_set.Tables("store").TableName Catch ex As SqlException MessageBox.Show(ex.Message) cnn.Close() End Try 例外錯誤 類型 'System.ArgumentNullException' 的未處理例外狀況發生於 system.data.dll 其他資訊: 值不能為 Null。 ------------------------------------- 已經確定資料表裡面有值,用datareader也能將資料讀出來 現在換成要在datagrid顯示 會在紅色那一行產生錯誤 拜託大家了 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.14.8.104 ※ 編輯: koge 來自: 163.14.8.104 (05/16 14:14)
cawQQ:你的SqlDataAdapter1哪來的?? 05/16 16:24
koge:寫錯了 更正 不過還是一樣的錯誤 05/17 12:44
※ 編輯: koge 來自: 163.14.8.104 (05/17 12:45)