使用global.asax

编程入门 行业动态 更新时间:2024-10-27 12:40:28
本文介绍了使用global.asax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 在Microsoft Visual Studio .NET 2003上, 我想使用一些全局元素, 可以在我的每个页面中使用。 即我将oleDBConnection放在global.asax.vb上 我该如何使用它(在global.asa.vb上的oleDBConnection)在另一个aspx 页面? 需要示例代码。 谢谢:)

Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ? Need sample code, please. Thanks :)

推荐答案

为什么你需要使用global.asax来做这样的事情???? 这是ASP时间...... 如果你需要指定一个可以通过任何 页面访问的连接字符串,你应该使用web .config文件。 在应用程序启动时从web .config获取并添加应用程序缓存。 通过应用程序缓存访问连接字符串。但是尝试重新设计 您的架构至少是两层应用....不要从网页访问数据库 .... - 谢谢, Yunus Emre ALP?ZEN BSc,MCAD.NET " John M" < nobody@nospam_please>在消息中写道 新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ... Why u need to use global.asax for something like this???? It was in ASP times... If you need to specify a connection string that can be accessed via any page, you should use web.config file. Get it from web .config at application startup and add it application cache. Access your connection string via application cache. But try to redesign your architecture as at least two tier application.... Don''t access database from web pages.... -- Thanks, Yunus Emre ALP?ZEN BSc, MCAD.NET "John M" <nobody@nospam_please> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... 您好, 在Microsoft Visual Studio .NET 2003上, 我想使用一些可以在我的每个页面中使用的全局元素。即我将oleDBConnection放在global.asax.vb上 如何在其他aspx 页面上使用它(global.asa.vb上的oleDBConnection)?需要请示例代码。 谢谢:) Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ? Need sample code, please. Thanks :)

所以, 我不明白 - 为什么不使用global.asax? 你所说的数据库连接&访问数据库:web.config 是首选。 (如果我只需要简单的临时变量,我可以使用global.asax)。 我需要一个示例代码。 (使用连接,访问数据库)。 谢谢:) Yunus Emre ALP?ZEN [MCAD.NET]" <叶*** @ msakademik>写在消息 新闻:eD ************** @ TK2MSFTNGP12.phx.gbl ... So, I don''t understand - why not using global.asax ? what you said is for database connection & accessing database : web.config is preferred. (If I need just simple temporary variables, I can use the global.asax). I need a sample code, please. (using connection, and accessing the database). Thanks :) "Yunus Emre ALP?ZEN [MCAD.NET]" <ye***@msakademik> wrote in message news:eD**************@TK2MSFTNGP12.phx.gbl... 为什么你需要使用global.asax用于这样的事情???? 这是在ASP时代... 如果你需要指定一个可以通过任何页面,你应该使用web.config文件。在应用程序启动时从web .config获取它并添加它应用程序缓存。通过应用程序缓存访问连接字符串。但是尝试将您的架构重新设计为至少两层应用程序....不要从网页访问数据库.... - 谢谢, Yunus Emre ALP?ZEN BSc,MCAD.NET John M < nobody@nospam_please>在消息中写道新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ... Why u need to use global.asax for something like this???? It was in ASP times... If you need to specify a connection string that can be accessed via any page, you should use web.config file. Get it from web .config at application startup and add it application cache. Access your connection string via application cache. But try to redesign your architecture as at least two tier application.... Don''t access database from web pages.... -- Thanks, Yunus Emre ALP?ZEN BSc, MCAD.NET "John M" <nobody@nospam_please> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... 你好, 在Microsoft Visual Studio .NET 2003上, 我想使用一些全局元素,可以在我的每个页面中使用。即我放global.asax.vb上的oleDBConnection 如何在其他aspx 页面上使用它(global.asa.vb上的oleDBConnection)?需要示例代码,请。 谢谢:) Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ? Need sample code, please. Thanks :)

....此外 - 我认为是网络。 config不支持* .mdb,但是支持sql 服务器 - 这是真的吗? (我使用的是* .mdb) 谢谢:) " John M" < nobody@nospam_please>写在消息 新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ... .... besides - I think that web.config doesn''t support *.mdb, but support sql server - Is that true ? (what I use is *.mdb) Thanks :) "John M" <nobody@nospam_please> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl... 所以, 我不明白 - 为什么不使用global.asax?你说的是数据库连接&访问数据库:web.config 是首选。(如果我只需要简单的临时变量,我可以使用global.asax)。 我需要一个示例代码,请。(使用连接,访问数据库)。 谢谢:) Yunus Emre ALP?ZEN [MCAD.NET]" <叶*** @ msakademik>在消息中写道新闻:eD ************** @ TK2MSFTNGP12.phx.gbl ... So, I don''t understand - why not using global.asax ? what you said is for database connection & accessing database : web.config is preferred. (If I need just simple temporary variables, I can use the global.asax). I need a sample code, please. (using connection, and accessing the database). Thanks :) "Yunus Emre ALP?ZEN [MCAD.NET]" <ye***@msakademik> wrote in message news:eD**************@TK2MSFTNGP12.phx.gbl... 为什么你需要使用global.asax像这样的东西???? 这是在ASP时代... 如果你需要指定一个可以通过任何页面访问的连接字符串,你应该使用web.config文件。在应用程序启动时从web .config获取它并添加它应用程序缓存。通过应用程序缓存访问连接字符串。但是尝试将您的架构重新设计为至少两层应用程序....不要从网页访问数据库.... - 谢谢, Yunus Emre ALP?ZEN BSc,MCAD.NET John M < nobody@nospam_please>在消息中写道新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ... Why u need to use global.asax for something like this???? It was in ASP times... If you need to specify a connection string that can be accessed via any page, you should use web.config file. Get it from web .config at application startup and add it application cache. Access your connection string via application cache. But try to redesign your architecture as at least two tier application.... Don''t access database from web pages.... -- Thanks, Yunus Emre ALP?ZEN BSc, MCAD.NET "John M" <nobody@nospam_please> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... 你好, 在Microsoft Visual Studio .NET 2003上, 我想使用一些全局元素,可以在我的每个页面中使用。即我放global.asax.vb上的oleDBConnection 如何在其他 aspx页面上使用它(global.asa.vb上的oleDBConnection)?需要示例代码,请。 谢谢:) Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ? Need sample code, please. Thanks :)

更多推荐

使用global.asax

本文发布于:2023-11-04 10:06:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557638.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:global   asax

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!