3
Good morning friends!
I need some help.
I am making a "Select" of an Excel spreadsheet in VB.Net to import the data in the database but a column is not bringing the data correctly. This column has both numbers and *’s; when it is numbers it brings the values, but when it is 's (, , *, ****) brings {}, I would like the whole column to return as String. It is possible?
--Method importing the spreadsheet
Dim dtbSheet As New DataTable
Dim wrkConnectionString As String = String.Format(CONNECTION_STRING_OLEDB_EXCEL, pPathFile)
Dim wrkSQL As String = String.Format("SELECT * FROM [{0}$]", pSheet)
'Intancia conexão
Dim wrkConnection As OleDbConnection = Nothing
Dim wrkCmd As OleDbCommand = Nothing
Dim wrkDa As OleDbDataAdapter = Nothing
Try
wrkConnection = New OleDbConnection(wrkConnectionString)
wrkCmd = New OleDbCommand(wrkSQL, wrkConnection)
wrkDa = New OleDbDataAdapter(wrkCmd)
wrkDa.Fill(dtbSheet)
Finally
If wrkConnection IsNot Nothing AndAlso wrkConnection.State = ConnectionState.Open Then wrkConnection.Close()
End Try
Return dtbSheet
--Example of the column
Hi William, did my code serve you or help you with the solution? If yes, please check the answer (see Help and take the Tour to understand the procedures here at Sopt). As you asked should mark the answer that best served you, when there are more than one, and in this and other answers and questions you can vote. All this helps the community here. Thanks.
– Leo