Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB Path

Status
Not open for further replies.

WestView

Technical User
Jan 7, 2003
67
US
This is driving me CRAZY! All I’m trying to do is change the database path from this:

Code:
    string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ Server.MapPath("access.mdb") +";";
    string sql = "select * from events";

To something like this:

Code:
    string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data SourceProvider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\dir1\dir2\dir3\database\access.mdb;    
string sql = "select * from events";

I’ve tried a hundred different combinations, and nothing works.

The entire code for the page is this:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server">

DataSet ds = new DataSet();
protected void Page_Load(Object Src, EventArgs E)
{
    string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ Server.MapPath("access.mdb") +";";
    string sql = "select * from events";
    
    OleDbDataAdapter da = new OleDbDataAdapter(sql, connectionstring);    
    da.Fill(ds, "events");
    
}

protected void eventscalendar_DayRender(Object Src, DayRenderEventArgs E)
{
    StringBuilder strEvents = new StringBuilder();
    strEvents.Append("<span style=\"font-size:80%\">");
    
    foreach (DataRow row in ds.Tables["events"].Rows)
    {
        DateTime eventdate = (DateTime)row["eventdate"];
        if (eventdate.Equals(E.Day.Date))
            strEvents.Append("<br />" + row["eventtext"]);
    }
    
    strEvents.Append("</span>");
    E.Cell.Controls.Add(new LiteralControl(strEvents.ToString()));
}
</script>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Event Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form runat="server">
    <asp:calendar DayStyle-HorizontalAlign="right" ID="eventcalendar" runat="server" ShowGridLines="true" OnDayRender="eventscalendar_DayRender"></asp:calendar>
</form>

</body>
</html>

Must I do something with the “Global.asax” ?

Any/all help would be greatly appreciated!!!

I'm using DW-MX 2004 on a asp.net server

- tom
 
I replied to your previous thread (thread855-1006166) which asked the same question. Did you look at that?

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top