473,594 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

@Import Syntax and Importing Namespaces in global.asax file

Tw part question:
1 - Is it <% @Import Namespace..... or <%@ Import Namespace... ? I'm seeing
it both ways in a book (but I think one is a typo. My pages don't seem to
care which it is. Or do they?....see below

2 - I'm trying to import the namespaces of System.Data and
System.Data.SQL Client in the global.asax file so I don't have to do this on
each page using SQL Server commands and data. But it doesn't seem to work.
I read you can do this. What's the trick if it's possible to do this? My
@Imports are above my <script> tag in the asax file like so:

<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<script language="vb" runat="server">
Sub Session_OnStart
....etc

Thanks guys!
Nov 18 '05 #1
1 4062
inline
-----Original Message-----
Tw part question:
1 - Is it <% @Import Namespace..... or <%@ Import Namespace... ? I'm seeingit both ways in a book (but I think one is a typo. My pages don't seem tocare which it is. Or do they?....see below
I don't think it matters.
2 - I'm trying to import the namespaces of System.Data and
System.Data.SQ LClient in the global.asax file so I don't have to do this oneach page using SQL Server commands and data. But it doesn't seem to work.I read you can do this. What's the trick if it's possible to do this? My@Imports are above my <script> tag in the asax file like so:
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<script language="vb" runat="server">
Sub Session_OnStart
....etc


You have to import it into each individual page.

Tu-Thach
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1217
by: Arjen | last post by:
Hi, I use form authentication for my asp.net 2.0 webapplication. When a user request a page it must first load some settings. These settings will be placed inside the context.items. I can add this method in all pages but that is not what I want. Easier will be one declaration... This loading happens inside the global.asax file. This way it loads automaticly the settings, no matter what page the user request. This is what
1
19036
by: khawar | last post by:
please provide code sample, i was having trouble declaring interger and string variable and can we also initialize them at the same time thanks for help
14
445
by: paul downing via DotNetMonster.com | last post by:
global file email send -------------------------------------------------------------------------------- guys, i'm developing an application and want to send an email with an error if it occurs to the administrator... i tried the following below but can't get it working. I did have it working a while ago...but have had no success with this.... any ideas? heres the code (simplistic) from the global.asax file:
1
1129
by: DavidM | last post by:
What is the difference between the Application_AuthenticateRequest and the Global_AuthenticateRequest events? I see that that the Global_AuthenticationRequest even fires before the Application_AuthenticateRequest event, but which event is the preferred mechanism to use if you want to implement some custom authentication code.
4
2363
by: Chris | last post by:
Hi, I want to put the namespaces and the data connection into global.asax like this: <%@ import namespace="System.Data"%> <%@ import namespace="System.Data.OleDb"%> <script runat="server"> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim oConnection As System.Data.OleDb.OleDbConnection oConnection = New System.Data.OleDb.OleDbConnection()
1
1900
by: Groove | last post by:
Hey guys - I'm sure this is a commonly asked question but here goes. I'm trying to catch the error in my global.asax file and redirect to a error page which will email me the actual error upon page load. Everything seems to work OK except catch the actual error. It detects the error when I break the connection string to MS SQL or pause the db itself. The error page is displayed and I get the email. Only problem is that my session...
0
3762
by: Alias | last post by:
Hi - I have a site that runs on a development and production server. I'd like to programmatically change the connection string the provider uses in the web.config file and have the provider use the updated string. I am able to successfully change the string using this code in the Application_Start method of the Global.asax file: Dim csNew As ConnectionStringSettings
5
14687
by: baburmm | last post by:
Hai, I want to get the Global static name(for Constant) Declared in the Global.asax file for my whole project as a constant. my coding in the Global.asax file is private static string strName = "ABCD"; public static string Names { get { return strName ; } }
0
935
by: Vinnarasi | last post by:
This is the error i get when i try to setup a portal which is built using rainbow portal. The type 'Rainbow.Global' is ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\merckpmo\6f7ce75e\8e014546\App_Code.edoyk-vp.DLL' or from assembly 'D:\merckpmo\bin\Rainbow.DLL'. Please specify the assembly explicitly in the type name. THIS IS THE CONTENT OF GLOBAL.ASAX FILE : <%@...
0
7876
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8251
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6654
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2385
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.