N
NetPointer
Hello all,
I m trying to add a column in my database (it is a csv file)
but it is giving me following exception.
------exception------------
{System.Data.OleDb.OleDbException}
ErrorCode: -2147467259
Errors: {System.Data.OleDb.OleDbErrorCollection}
HelpLink: Nothing
InnerException: Nothing
Message: "Operation not supported on a table that contains data."
Source: "Microsoft JET Database Engine"
StackTrace: " at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
Here is my code for this.
--------Code--------------
Dim ConnectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended Properties=""text;HDR=Yes;FMT=Delimited"""
Dim myCon As New OleDbConnection(ConnectString)
Try
myCon.Open()
'Debug.WriteLine("Connection Opened")
Dim cmd As New OleDbCommand
cmd.CommandText = "ALTER TABLE [sample.csv] ADD mycol VARCHAR(50) NULL"
cmd.Connection = myCon
cmd.ExecuteNonQuery()
Catch ex As OleDbException
debug.WriteLine(ex.Message)
Finally
myCon.Close()
End Try
Any known reasons and workarounds????
Thanks & Regards.
I m trying to add a column in my database (it is a csv file)
but it is giving me following exception.
------exception------------
{System.Data.OleDb.OleDbException}
ErrorCode: -2147467259
Errors: {System.Data.OleDb.OleDbErrorCollection}
HelpLink: Nothing
InnerException: Nothing
Message: "Operation not supported on a table that contains data."
Source: "Microsoft JET Database Engine"
StackTrace: " at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
Here is my code for this.
--------Code--------------
Dim ConnectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended Properties=""text;HDR=Yes;FMT=Delimited"""
Dim myCon As New OleDbConnection(ConnectString)
Try
myCon.Open()
'Debug.WriteLine("Connection Opened")
Dim cmd As New OleDbCommand
cmd.CommandText = "ALTER TABLE [sample.csv] ADD mycol VARCHAR(50) NULL"
cmd.Connection = myCon
cmd.ExecuteNonQuery()
Catch ex As OleDbException
debug.WriteLine(ex.Message)
Finally
myCon.Close()
End Try
Any known reasons and workarounds????
Thanks & Regards.