Torna al Thread

Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=""text;HDR=Yes;FMT=Delimited""" Dim objConn As New OleDbConnection(sConnectionString) objConn.Open() Dim objCmdSelect As New OleDbCommand("SELECT * FROM Testa.csv", objConn) ''le righe sotto commentate le usi ? ''Dim objAdapter1 As New OleDbDataAdapter() ''objAdapter1.SelectCommand = objCmdSelect Dim objDataTable As New DataTable() Dim objDataReader As OleDbDataReader = objCmdSelect.ExecuteReader(System.Data.CommandBehavior.CloseConnection) objDataTable.Load(objDataReader) ' Non capisco perche' creare un altro datatable ??? ' A cosa serve passargli le row che hai gia ?. ' E per di piu' e scorretto ImportRow si usa per ' i datatable tipizzati o con colonne definite. ' altrimenti copia le row ma sei senza colonne. ' Commento le righe sotto non servono a niente. ''For Each dr As DataRow In objDataTable.Rows '' EsportaTabella.ImportRow(dr) ''Next TableDataGrid.DataSource = objDataTable 'cambiato il datasource da EsportaTabella a dt che hai gia.
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5