Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi,

I am a fresher with develoment of web applications using .Net 4. framework.
Currently I am developing application using LINQ. I am using Sql Server Express 2008 RS2 / Vista Home Premium sp2

I have a Local database (.mdf) file added in the App_Data folder in my project. I want to put my DB tables in cache using SQl Cache Dependency ...To do so, I tried to execute "Alter Database mydb SET ENABLE_BROKER" query for this local database but it gives errors. I have searched a lot for this. :(
Please suggest me steps to how to successfully enable Broker for this type of local Database (.mdf) file.
Thanx,
Jass
Posted
Updated 23-Nov-10 14:19pm
v2
Comments
Manfred Rudolf Bihy 24-Nov-10 7:42am    
What errors! We're not into mind reading, mind you. You'll have to give us some hints as to what is going wrong before we can help you.
Jass22 24-Nov-10 14:55pm    
My apologies,
When I open my project. My Local Database (.mdf) successfully connects to the SQL Server. (In the server explorer shows as follows
-------------------------------------

Data Connections
MyDB.mdf
Database Diagrams
Tables
Views
Stored procedures
Functions
etc
My-PC\sqlexpress.aspnetdb.dbo
My-PC\sqlexpress.dbEmployee.dbo
Servers
My-PC
-----------------------------------------------------
Now, To Run Query { Alter Database myDB Set Enable_Broker },
I go to the T-SQL Editor under Data menu and open a NEW QUERY Connection.
In the Editor, I type the same query as it is. And It gives me error as follows:
--------------------------
Msg 5011, Level 14, State 5, Line 1
User does not have permission to alter database 'dbbooks', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
---------------------------

Also,
I tried,
To attach my local db .mdf file using Management Studio but gives the following error:

=======================================================================
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
CREATE FILE encountered operating system error 32(failed to retrieve text for this error. Reason: 15100) while attempting to open or create the physical file 'G:\ABC\BookShopping\App_Data\MyDB.mdf'. (Microsoft SQL Server, Error: 5123)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476
=================================================================
I want to execute the Enable Broker query for my local database .mdf file.
Thanks,
Jass

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900