@Import Syntax and Importing Namespaces in global.asax file

Discussion in 'ASP .Net' started by D. Shane Fowlkes, Jan 13, 2004.

  1. 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.SQLClient 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="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>


    <script language="vb" runat="server">
    Sub Session_OnStart
    ....etc

    Thanks guys!
     
    D. Shane Fowlkes, Jan 13, 2004
    #1
    1. Advertising

  2. D. Shane Fowlkes

    Tu-Thach Guest

    inline

    >-----Original Message-----
    >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


    I don't think it matters.

    >2 - I'm trying to import the namespaces of System.Data and
    >System.Data.SQLClient 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="System.Data" %>
    ><%@ Import Namespace="System.Data.SqlClient" %>
    >
    >
    ><script language="vb" runat="server">
    >Sub Session_OnStart
    >....etc
    >


    You have to import it into each individual page.

    Tu-Thach
     
    Tu-Thach, Jan 13, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    1
    Views:
    817
    Alvin Bruney
    Jul 29, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    6,935
    Daniel Bass
    Dec 31, 2003
  3. 2obvious

    no global constants in global.asax?

    2obvious, Sep 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,873
  4. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    894
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  5. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,197
    Mark Rae
    May 23, 2006
Loading...

Share This Page