you can save the small tables into memory using application object-.Net技术-3P代码网
繁体中文
设为首页
加入收藏
当前位置:.Net技术首页 >> Asp.Net开发 >> you can save the small tables into memory using application object

you can save the small tables into memory using application object

2007-09-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:protected void Application_Start(Object sender, EventArgs e) { System.Data.DataSet ds; System.Data.OleDb.OleDbConnection oleDbConnection1; System.Data.OleDb.OleDbDataAdapter daAttendees; System.Da...

protected void Application_Start(Object sender, EventArgs e)

{

System.Data.DataSet ds;

System.Data.OleDb.OleDbConnection oleDbConnection1;

System.Data.OleDb.OleDbDataAdapter daAttendees;

System.Data.OleDb.OleDbDataAdapter daRooms;

System.Data.OleDb.OleDbDataAdapter daEvents;

oleDbConnection1 = new System.Data.OleDb.OleDbConnection();

oleDbConnection1.ConnectionString = @” ... “;

oleDbConnection1.Open();

ds = new DataSet();

daAttendees = new System.Data.OleDb.OleDbDataAdapter(

“SELECT * FROM Attendees”, oleDbConnection1);

daRooms = new System.Data.OleDb.OleDbDataAdapter(

“SELECT * FROM Rooms”, oleDbConnection1);

daEvents = new System.Data.OleDb.OleDbDataAdapter(

“SELECT * FROM Events”, oleDbConnection1);

daAttendees.Fill(ds, “Attendees”);

daRooms.Fill(ds, “Rooms”);

daEvents.Fill(ds, “Events”);

oleDbConnection1.Close();

Application[“ds”] = ds;

}

Here we are creating a name in the Application store called ds, which takes the serialized value of ds DataSet containing the Attendees, Rooms, and Events tables from our database. This value will be accessible to all instances of the Web service at any time.

责任编辑:admin
相关文章