Re: [.NET] Unable to cast object of type
※ 引述《mindscold (喵)》之銘言:
: Dim Table As DataTable = DirectCast(Me.myBindingSource.DataSource, DataTable)
: 並且出現以下的錯誤訊息:
: "Unable to cast object of type 'PICData.PICSettingDataSet' to type
: 'System.Data.DataTable'
: 請問為什麼datasource也是table卻不能轉換成datatable?
: 該怎麼改才是對的呢?謝謝
Try
Dim ds as DataSet = CType(Me.myBindingSource.DataSource, DataSet)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim dt1 as DataTable = ds.Tables(0)
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.104.148.39
→
01/15 19:29, , 1F
01/15 19:29, 1F
→
01/15 19:29, , 2F
01/15 19:29, 2F
推
01/17 08:23, , 3F
01/17 08:23, 3F
討論串 (同標題文章)