TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhijit barua
1.2k
508
310.7k
How can i implement push based sql dependency.
May 4 2012 12:06 AM
I want to implement push based sql dependecy for auto update of gridview data when database have some changes. I change database(sql server 2008) broker now it is enable, i also grant priviledge. I write code to test in .cs page like below.
if (Cache["test"] == null)
{
string connectionString = ConfigurationManager.ConnectionStrings["book"].ConnectionString;
SqlConnection myConnection = new SqlConnection(connectionString);
SqlDataAdapter ad = new SqlDataAdapter("SELECT * from test", myConnection);
DataSet ds = new DataSet();
ad.Fill(ds);
SqlCacheDependency sqlDepend = new SqlCacheDependency(ad.SelectCommand);
Cache.Insert("test", ds, sqlDepend);
}
GridView2.DataSource = Cache["test"] as DataSet;
GridView2.DataBind();
And in web config i put like below
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add connectionStringName="book" name="book"/>
</databases>
</sqlCacheDependency>
</caching>
Reply
Answers (
7
)
Question about gridview header checkbox on pageindex change
Bug?