S
Saumin
hi,
I want to import a csv file into my excel template file programmatically in
a windows application. i am using vb.net, ado.net to do this. but i am
getting an error: Operation must use an updateable query. I have checked
security and it is fine. aspnet user has full permissions on both the files.
I will really appreciate a quick response. following is the code:
csvPath = "c:\"
strCSVConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source={0};Extended Properties=""text;HDR=No;FMT=Delimited""", csvPath)
Dim objCSVConn As New OleDbConnection(strCSVConn)
objCSVConn.Open()
Dim objCmd As New OleDbCommand
objCmd.Connection = objCSVConn
Try
objCmd.CommandText = "Insert INTO [Sheet1$] IN 'C:\Book1.xls'
'Excel 8.0;' SELECT * FROM 261_WildOats_12292004_EE.csv"
objCmd.ExecuteNonQuery()
objCSVConn.Close()
Catch ex As Exception
If Not (objCSVConn Is Nothing) Then
objCSVConn.Close()
End If
MsgBox(ex.Message)
End Try
Thanks,
Saumin
I want to import a csv file into my excel template file programmatically in
a windows application. i am using vb.net, ado.net to do this. but i am
getting an error: Operation must use an updateable query. I have checked
security and it is fine. aspnet user has full permissions on both the files.
I will really appreciate a quick response. following is the code:
csvPath = "c:\"
strCSVConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source={0};Extended Properties=""text;HDR=No;FMT=Delimited""", csvPath)
Dim objCSVConn As New OleDbConnection(strCSVConn)
objCSVConn.Open()
Dim objCmd As New OleDbCommand
objCmd.Connection = objCSVConn
Try
objCmd.CommandText = "Insert INTO [Sheet1$] IN 'C:\Book1.xls'
'Excel 8.0;' SELECT * FROM 261_WildOats_12292004_EE.csv"
objCmd.ExecuteNonQuery()
objCSVConn.Close()
Catch ex As Exception
If Not (objCSVConn Is Nothing) Then
objCSVConn.Close()
End If
MsgBox(ex.Message)
End Try
Thanks,
Saumin