D
David C
I have a web application that needs to read several dBase files created by a
user application. I can read them and display display them in a GridView
just fine using the code example below.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim sConnectionString As String
Dim strSQL As String = "SELECT * FROM " & "1KGI0CYV"
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\ltserver\Apps\Pathways\Data\extcomm\emsout\;Extended
Properties=dBase IV"
Dim objConn As New
System.Data.OleDb.OleDbConnection(sConnectionString)
objConn.Open()
Dim da As New System.Data.OleDb.OleDbDataAdapter(strSQL, objConn)
Dim ds As New DataSet("1KGI0CYV")
da.Fill(ds, "1KGI0CYV")
Dim dt As DataTable
dt = ds.Tables("1KGI0CYV")
gvEnvFiles.DataSource = dt
gvEnvFiles.DataBind()
objConn.Close()
End Sub
The problem is that each dBase file has to be renamed with a .dbf extension
for the above to work.
The example file above is named 1KGI0CYV.env and I would like to open it
without renaming it, if possible.
When I try to add the file name to the Data Source= parameter it fails with
the error "... is not a valid path."
Thanks.
David
user application. I can read them and display display them in a GridView
just fine using the code example below.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Dim sConnectionString As String
Dim strSQL As String = "SELECT * FROM " & "1KGI0CYV"
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\ltserver\Apps\Pathways\Data\extcomm\emsout\;Extended
Properties=dBase IV"
Dim objConn As New
System.Data.OleDb.OleDbConnection(sConnectionString)
objConn.Open()
Dim da As New System.Data.OleDb.OleDbDataAdapter(strSQL, objConn)
Dim ds As New DataSet("1KGI0CYV")
da.Fill(ds, "1KGI0CYV")
Dim dt As DataTable
dt = ds.Tables("1KGI0CYV")
gvEnvFiles.DataSource = dt
gvEnvFiles.DataBind()
objConn.Close()
End Sub
The problem is that each dBase file has to be renamed with a .dbf extension
for the above to work.
The example file above is named 1KGI0CYV.env and I would like to open it
without renaming it, if possible.
When I try to add the file name to the Data Source= parameter it fails with
the error "... is not a valid path."
Thanks.
David