Paulconsulting
asked on
Asp.net connectionissues to DBF database
I am having some problems connecting from an asp.net application to a foxpro database named Customers.dbf.
With the code below, it looks like I am connecting but it can't find the table. I don't know what I am missing still.
Error:
Exception Details: System.Data.OleDb.OleDbExc eption: The Microsoft Jet database engine could not find the object 'customers'. Make sure the object exists and that you spell its name and the path name correctly.
With the code below, it looks like I am connecting but it can't find the table. I don't know what I am missing still.
Error:
Exception Details: System.Data.OleDb.OleDbExc
Dim strConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Websites\AppName\App_Data\;Extended Properties=dBASE IV;User ID=Admin;Password=;"
Dim objConn As New OleDbConnection
Dim objCmd As OleDbCommand
Dim ObjDR As OleDbDataReader
objConn.ConnectionString = strConnectionString
objCmd = New OleDbCommand("Select * from customers", objConn)
objCmd.CommandType = CommandType.Text
objConn.Open()
ObjDR = objCmd.ExecuteReader()
If ObjDR.Read() Then
Response.Write("<Br>JobName: " & ObjDR("JobName"))
End If
ObjDR.Close()
ASKER
It is failing when the command reader is executing. I changed my code to the above. ( I do realize that the code i had posted will only get one record, i was just trying to put up an example of what "code" was breaking")
It looks to me that it isn't finding the table "Customers"
It looks to me that it isn't finding the table "Customers"
Line 32: objConn.Open()
Line 33:
Line 34: ObjDR = objCmd.ExecuteReader() 'Falure on this line
Line 35: While ObjDR.Read
Line 36: If ObjDR.Read() Then
Not real familiar with dBASE IV Jet driver, but don't you need a file name for the Data Source?
Data Source=D:\Websites\AppName \App_Data\ dbasdefilenamehere?
Data Source=D:\Websites\AppName
ASKER
From what I read on connecting to a foxpro databae, you don't add the filename at the end of the path, just the folder it resides in.
So it is supposed to find the customers object from the Customers.dbf filename and use it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well:
1 - The path name is a correct direct path to the dbf (maybe i have the path naming system wrong, such as i might need to do relative paths?)
2 - I see the Cusomers.dbf in the app folder
3 - For pure testing, i have given the entire folder "Full control" by the admin. I have also included impersonation in my web.config (<identity impersonate="true" userName="Administrator" password="12345"/>)
I wonder since it is in the app_data folder, asp.net won't give access to it. I am going to move the dbf to a new folder and test that.
1 - The path name is a correct direct path to the dbf (maybe i have the path naming system wrong, such as i might need to do relative paths?)
2 - I see the Cusomers.dbf in the app folder
3 - For pure testing, i have given the entire folder "Full control" by the admin. I have also included impersonation in my web.config (<identity impersonate="true" userName="Administrator" password="12345"/>)
I wonder since it is in the app_data folder, asp.net won't give access to it. I am going to move the dbf to a new folder and test that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok lets try this from another angle if you are willing. When a cookie writes it writes the username how can i use this for example
Username@www.txt
If I can read the username from the text file
Username@www.txt
If I can read the username from the text file
ok and I see you added my
while ObjDr.Read
while ObjDr.Read
ad 3: You don't need the full path, if the path you provide in the connection string is the path to the tables, the pure file name customers.dbf is sufficient.
Regarding permissons, well, whatever system account executes your ASP.net code will need permisson on DBFs of course. No more, no less.
Bye, Olaf.
Regarding permissons, well, whatever system account executes your ASP.net code will need permisson on DBFs of course. No more, no less.
Bye, Olaf.
Thanks Paulconsulting, glad you got it to work.
If ObjDR.Read() Then
Response.Write("<Br>JobNam
End If
end while