|
|
 |
BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9  | This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Special Edition by Bill Evjen, Scott Hanselman, Devin Rader, Farhan Muhammad, Srinivasa Sivakumar; ISBN: 9780470041789 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

November 24th, 2008, 11:48 AM
|
|
Registered User
|
|
Join Date: Nov 2008
Location: Pawleys Island, SC, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Developing pages with IIS
As I did with ASP, I am using IIS to develop pages with asp.net. However, I cannot make relative addresses work. Here is my code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim cn As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet .OLEDB.4.0;DataSource=~/committees.mdb;")
Dim cn As New Data.OleDb.OleDbConnection("PROVIDER=Microsoft.Jet .OLEDB.4.0;DATA SOURCE=" & _
"D:\websites\pbocchurch\church\aspx\committees.mdb ;")
Dim da As New Data.OleDb.OleDbDataAdapter("select * from major", cn)
Dim dt As New Data.DataTable
da.Fill(dt)
da.Dispose()
cn.Dispose()
Me.GridView1.DataSource = dt
Me.GridView1.DataBind()
End Sub
And at the top of the page
<%@ Page Language=" VB" AutoEventWireup="false" CodeFile="connect2.aspx. vb" Inherits="connect2" Debug="true"%>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data" %>
Now, if I use a relative address in the connection string, ie,
("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
"committees.mdb;")
I get the following error: "Could not find file 'C:\WINDOWS\system32\committees.mdb'."
The problem is when I upload the completed file, the full address will be incorrect. How can I make relative addresses work in IIS?
|

November 25th, 2008, 12:02 AM
|
|
Wrox Author
Points: 12,827, Level: 49 |
|
|
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
|
|
You need to do something like this:
"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & _
Server.MapPath("committees.mdb") & ";"
hth.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |