The first query will run but the second will not:
Dim constring As String
Dim id As String = "10-03"
File.Delete(FilePath & CSVFileName)
constring = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
FilePath & DataBaseFileName)
Dim objadapter As New OleDbDataAdapter
With objadapter
.SelectCommand = New OleDbCommand
.SelectCommand.CommandText = ("SELECT * INTO
[Text;DATABASE=C:\myFiles\].[test.csv] FROM [Interest Group List];")
.SelectCommand.CommandType = CommandType.Text
.SelectCommand.Connection = New OleDbConnection(constring)
.SelectCommand.Connection.Open()
.SelectCommand.ExecuteNonQuery()
.SelectCommand.Connection.Close()
End With
Using this line throws the following error on the ExecuteNonQuery() line:
..SelectCommand.CommandText = ("SELECT[list number] INTO
[Text;DATABASE=C:\myFiles\\].[test.csv] FROM [Interest Group List];")
Error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll
Why do I get a column name into the SELECT? The column name does have a
space and I can't get around that.
Thanks,
Brett