[.NET] 關於datagrid 的例外錯誤
這是我的程式碼
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)
推
05/16 16:24, , 1F
05/16 16:24, 1F
推
05/17 12:44, , 2F
05/17 12:44, 2F
※ 編輯: koge 來自: 163.14.8.104 (05/17 12:45)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章