Juan,
I tried the path, which did not work.
I tried the physical path, but it is still looking on my c drive instead of
the server.
Here is the error message and the code follows. Can you tell my what is my
problem?
'c:\windows\system32\inetsrv\www.wheelers.com\fpbd \Acc.mdb' is not a valid
path. Make sure that the path name is spelled correctly and that you are
connected to the server on which the file resides.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException:
'c:\windows\system32\inetsrv\www.wheelers.com\fpbd \Acc.mdb' is not a valid
path. Make sure that the path name is spelled correctly and that you are
connected to the server on which the file resides.
Source Error:
Line 6: Dim DBConnection As OledbConnection
Line 7: DBConnection = New
OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data
Source=www.wheelers.com\fpbd\Acc.mdb")
Line 8: DBConnection.Open()
Line 9:
Line 10: Dim DBCommand As OledbCommand
Source File: e:\accounts\whee13\WWW\database_acc_host.aspx Line: 8
Stack Trace:
[OleDbException (0x80004005):
'c:\windows\system32\inetsrv\www.wheelers.com\fpbd \Acc.mdb' is not a valid
path. Make sure that the path name is spelled correctly and that you are
connected to the server on which the file resides.]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
System.Data.OleDb.OleDbConnection.Open() +203
ASP.database_Acc_host_aspx.Page_Load(Object sender, EventArgs e) in
e:\accounts\whee13\WWW\database_acc_host.aspx:8
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data.Oledb" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim DBConnection As OledbConnection
DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data
Source=www.wheelers.com\fpbd\Acc.mdb")
DBConnection.Open()
Dim DBCommand As OledbCommand
DBCommand = New OledbCommand("SELECT * FROM table1, Acc")
Dim SQLString AS String
SQLString = "SELECT * FROM Table1"
DBCommand = New OleDBCommand(SQLString, DBConnection)
Dim DBReader AS OledbDatareader
DBReader = DBCommand.ExecuteReader()
MyDataGrid.DataSource = DBReader
MyDataGrid.DataBind()
DBReader.Close()
DBConnection.Close()
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DataGrid id="MyDataGrid" runat="server"/>
</form>
</body>
</html>
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:O%****************@TK2MSFTNGP02.phx.gbl...
re:
!DBConnection = New
OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=Acc.mdb"
That connection assumes the mdb file is located in the
c:\windows\system32\inetsrv directory.
An OledbConnection expects a complete physical directory path,
if the path is ,ocated outside the website's directory path :
c:\somepath\someother dir\Acc.mdb
or... a virtual path which can be translated by Server.MapPath.
DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data
Source=" & Server.Mappath "/App_Data/Acc.mdb")
Btw, Acc.mdb should *never* be placed anywhere but in the App_Data
directory.
As long as the mdb is in the App_Data dir, it cannot be downloaded via a
direct link.
Placing it in the root directory of your app allows hackers to download
your database.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eV**************@TK2MSFTNGP03.phx.gbl...
"dancer" <da****@microsoft.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I did NOT install Microsoft Access.
That's good.
>The reason I went to my host server TO install it is because YOU asked,
"Have you actually installed a copy of Microsoft Access on your
webserver? Yes or no?"
when I mentioned the error, "Could not find file
'c:\windows\system32\inetsrv\Acc.mdb'"
Do you remember that?
Yes I do.
>Why did you ask me that?
Because I wanted to make certain that you *hadn't* installed Microsoft
Access on your webserver... :-)
>What is your reason as to why I get the above error when trying to run my
file at my host server? Why is it looking for the file on my computer?
I
downloaded the acc.mdb file to the host. Nowhere in my code do I refer
to
"c:\windows, etc."
Because it can't find the Jet database, so it's looking in the folder it's
currently running from instead...
>DBConnection = New OledbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data
Source=Acc.mdb"
Where *precisely* on your webserver is the Acc.mdb Jet database? Is it in
your web app's virtual directory, maybe in the App_Data subfolder...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net