Re: [.NET] 關於datagrid 的例外錯誤

看板Visual_Basic作者 (真實與幻想)時間19年前 (2006/05/17 15:28), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《koge (柯基)》之銘言: : 這是我的程式碼 : 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") ^^^^^^^^^^ 試看看~拿掉那段之後~還有沒有問題 如果沒問題的話~就是你的DataSet裡面沒有那個DataTable.. 你要怎麼指定塞哪個DataTable?? : 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: 61.64.117.158
文章代碼(AID): #14Qj2iAc (Visual_Basic)
討論串 (同標題文章)
文章代碼(AID): #14Qj2iAc (Visual_Basic)