Hello All,
This is driving me CRAZY! All I’m trying to do is change the database path from this:
To something like this:
I’ve tried a hundred different combinations, and nothing works.
The entire code for the page is this:
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
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