Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Modules in ASP.NET pages

Modules in ASP.NET pages

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasequestionasp-netsql-server
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Quecumber256
    wrote on last edited by
    #1

    Is this possible in ASP.NET in Visual Studio 2005. I want to create a web site that contains about 4 pages. The data for each page is stored on a SQL Server 2005 database. The ConnectionString is always the same, but the SelectCommand will differ depending on that page's function. Can't I place these instructions into a global module on the web site and have them called when needed? If this is possible, how do I create a VB module on the web site? Thank you, Quecumber256

    V E V 3 Replies Last reply
    0
    • Q Quecumber256

      Is this possible in ASP.NET in Visual Studio 2005. I want to create a web site that contains about 4 pages. The data for each page is stored on a SQL Server 2005 database. The ConnectionString is always the same, but the SelectCommand will differ depending on that page's function. Can't I place these instructions into a global module on the web site and have them called when needed? If this is possible, how do I create a VB module on the web site? Thank you, Quecumber256

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      Hey Quecumber256, VB modules are not recommended in .NET world. But you can still create a module of your own. Just click Add New Item and add a class file. Then clear the file and add

      Public Module MODULENAME

      End MODULENAME

      Don't try to change the extension. The file extension should be .vb only. Another solution: If you are going to store only the ConnectionString info then use Web.Config file which is recommended by .NET. If you want to remember any objects try Sessions. Have a nice day man...

      Regards, Venkatesh Mookkan. Software Engineer

      1 Reply Last reply
      0
      • Q Quecumber256

        Is this possible in ASP.NET in Visual Studio 2005. I want to create a web site that contains about 4 pages. The data for each page is stored on a SQL Server 2005 database. The ConnectionString is always the same, but the SelectCommand will differ depending on that page's function. Can't I place these instructions into a global module on the web site and have them called when needed? If this is possible, how do I create a VB module on the web site? Thank you, Quecumber256

        E Offline
        E Offline
        ednrgc
        wrote on last edited by
        #3

        You can place the connection string (and others) in the web.config

        1 Reply Last reply
        0
        • Q Quecumber256

          Is this possible in ASP.NET in Visual Studio 2005. I want to create a web site that contains about 4 pages. The data for each page is stored on a SQL Server 2005 database. The ConnectionString is always the same, but the SelectCommand will differ depending on that page's function. Can't I place these instructions into a global module on the web site and have them called when needed? If this is possible, how do I create a VB module on the web site? Thank you, Quecumber256

          V Offline
          V Offline
          Vikram kshatriya
          wrote on last edited by
          #4

          Hi , Store the ConnectionString in web.Config's AppSetting .Add a new class(note this is not amodule) and write your functions to retrieve the data from database .IN code behind page , call the methods from the class to display the records into page.

          Vicky

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups