Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 19th, 2011, 09:47 AM
Authorized User
Points: 222, Level: 4
Points: 222, Level: 4 Points: 222, Level: 4 Points: 222, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2007
Location: Phoenix, AZ, USA.
Posts: 48
Thanks: 4
Thanked 0 Times in 0 Posts
Default Unable to connect to SQL database

Hi,

I'm working listings 20-5 and 20-6, and keep getting the following error:

Unable to connect to SQL database 'Northwind' for cache dependency polling

I have run the aspnet_regsql.exe command to enable cacheing for both tables and the database. When I use the -lt option, both tables (Customers and Products) are listed. But when I open the AspNet_SqlCacheTablesForChangeNotification table, it is empty.

Here is my code:

<code>

aspx
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="SqlCacheInvalidation.aspx.cs"Inherits="SqlCacheDependencies"Trace="true" %>
<%
@OutputCacheDuration="3600"VaryByParam="none"SqlDependency="Northwind:Customers" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
htmlxmlns="http://www.w3.org/1999/xhtml">
<
headrunat="server">
<title>Sql Cache Invalidation</title>
</
head>
<
body>
<formid="form1"runat="server">
<div>
<asp:LabelID="Label1"runat="server"></asp:Label>
<asp:GridViewID="GridView1"runat="server">
</asp:GridView>
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:AppConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:AppConnectionString1.ProviderNam e %>"SelectCommand="SELECT * FROM [Customers]">
</asp:SqlDataSource>
</div>
</form>
</
body>
</
html>

code behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
publicpartialclassSqlCacheDependencies :
System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
Label1.Text =
"Page created at " + DateTime.Now.ToShortTimeString();
}
}

web.config

<connectionStrings>
<
removename="LocalSqlServer"/>
<
addname="LocalSqlServer"connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|aspnet.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>
<
addname="AppConnectionString1"connectionString=
"data source=tommagaro-pc\sqlexpress; database=Northwind; Persist Security info=false"
providerName="System.Data.SqlClient"/>
</
connectionStrings>
<
system.web>
<
caching>
<
sqlCacheDependencyenabled="true">
<
databases>
<
addname="Northwind"connectionStringName="AppConnectionString1"
pollTime="500"/>
</
databases>
</
sqlCacheDependency>
</
caching>

</code>

Has anyone else encountered this problem?


The flashman
__________________
Thomas G Magaro
  #2 (permalink)  
Old July 19th, 2011, 11:58 AM
Authorized User
Points: 222, Level: 4
Points: 222, Level: 4 Points: 222, Level: 4 Points: 222, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2007
Location: Phoenix, AZ, USA.
Posts: 48
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Never mind. I had the -et out of place.
__________________
Thomas G Magaro
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to connect sql server 2005 priyan.viji Internet Information Services 1 December 16th, 2008 11:57 AM
Unable to connect to pubs database... help! scottkhughes BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 September 10th, 2008 09:35 AM
How to connect SQL Database eapsokha Classic ASP Professional 1 March 10th, 2004 04:18 AM
Connect to sql database kale_tushar Pro VB 6 8 September 8th, 2003 04:27 AM
[000] Unable to connect to server 'SERVER\SQL'; SQ ctanchan SQL Server 2000 1 August 15th, 2003 08:18 AM



All times are GMT -4. The time now is 03:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.