Cannot update. Database or object is read-only
I've added file entry in 'schema.ini' file, also I've created a dummy
System DSN and added new extension 'log' in it, but no success.
Here is the code:
//--------------------------------------------
string strConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\data\\; Extended Properties=\"Text;HDR=YES;\"";
// open connection
OleDbConnection oCon = new OleDbConnection(strConString);
oCon.Open();
// fill data set
string strSql = "SELECT * FROM datafile.txt";
OleDbDataAdapter oDA = new OleDbDataAdapter( strSql, oCon );
DataSet oData = new DataSet();
oDA.Fill( oData, datafile.txt ); // -- error if file extension is
log
oCon.Close();
//---------------------------------------------
Any help??
TF
Can you look at this sample I have made.
The delimiter has to be in your culture setting standard otherwise you have
to play with it.
I hope this helps?
Cor
\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
¤ Hi,
By default the Text ISAM driver is only set up to support specific file extensions. Modifying the
Registry or renaming the file temporarily will resolve the issue. See the following MS KB article
for more info:
ACC2000: Importing or Linking a Text File Fails for a File That Does Not Have a Valid File Name
Extension
http://support.microsoft.com/default.aspx?scid=kb;en-us;304206
Paul ~~~ pcle...@ameritech.net
Microsoft MVP (Visual Basic)