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. asp.net, ado.net, c# question

asp.net, ado.net, c# question

Scheduled Pinned Locked Moved ASP.NET
9 Posts 3 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.
  • J Offline
    J Offline
    jboyd111
    wrote on last edited by
    #1

    Hello, I'm relatively new to c# and even newer to asp.net and ado.net. I'm trying to improve my skills in the asp.net and ado.net areas. I'm working on an a sample app where I want to display items in a web page based on what the user has selected from a drop-down list. A couple of questions I have while on this learning path: 1 -Are all database queries and "presentation" done within the .aspx files, or are some done in the .cs files? Thanks in advance. --------- Jeff

    C Y 2 Replies Last reply
    0
    • J jboyd111

      Hello, I'm relatively new to c# and even newer to asp.net and ado.net. I'm trying to improve my skills in the asp.net and ado.net areas. I'm working on an a sample app where I want to display items in a web page based on what the user has selected from a drop-down list. A couple of questions I have while on this learning path: 1 -Are all database queries and "presentation" done within the .aspx files, or are some done in the .cs files? Thanks in advance. --------- Jeff

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Good question. In fact, your database queries SHOULD come from a seperate dll which encapsulates DB code. Microsoft have added ways to do database stuff in the ASPX, but no-one uses them except hobbyists and people who don't know/don't care about writing good code. You should run from any control that has you typing SQL into your aspx. You should try to wrap your database code into a seperate layer. Ideally, your database layer would not return database objects but take and return lists of classes in your project.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      1 Reply Last reply
      0
      • J jboyd111

        Hello, I'm relatively new to c# and even newer to asp.net and ado.net. I'm trying to improve my skills in the asp.net and ado.net areas. I'm working on an a sample app where I want to display items in a web page based on what the user has selected from a drop-down list. A couple of questions I have while on this learning path: 1 -Are all database queries and "presentation" done within the .aspx files, or are some done in the .cs files? Thanks in advance. --------- Jeff

        Y Offline
        Y Offline
        Yusuf
        wrote on last edited by
        #3

        Jeff, I like to break my design into three layers 1. Presentation 2. Business Logic 3. Database 1. In presentation layer I put only those that are of UI related. This will go directly into the aspx pages, user controls (usually I create on separate dll) and any UI related logic 2. Database. This is strictly database related classes. NO other code belongs here. 3. In business logic goes any middle-ware code that does not belong to any of the two categories. Now, notice how I said 'This goes to separate dll' in the first case. I don't go crazy in creating many dlls. The rule of thumb I use is, if the code can be reused somewhere else, then I create it in its logical dll, so I can easily take it to another project and reused. That means the other layers may have multiple dlls as well. Again, there are projects I have worked which they have only 2 layer or more than 3 layers. It does not have to be only 3 layers. The scope of the project will decide how you want to break your logical designs. In some cases you may be able to get away with single layer.

        Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

        J 1 Reply Last reply
        0
        • Y Yusuf

          Jeff, I like to break my design into three layers 1. Presentation 2. Business Logic 3. Database 1. In presentation layer I put only those that are of UI related. This will go directly into the aspx pages, user controls (usually I create on separate dll) and any UI related logic 2. Database. This is strictly database related classes. NO other code belongs here. 3. In business logic goes any middle-ware code that does not belong to any of the two categories. Now, notice how I said 'This goes to separate dll' in the first case. I don't go crazy in creating many dlls. The rule of thumb I use is, if the code can be reused somewhere else, then I create it in its logical dll, so I can easily take it to another project and reused. That means the other layers may have multiple dlls as well. Again, there are projects I have worked which they have only 2 layer or more than 3 layers. It does not have to be only 3 layers. The scope of the project will decide how you want to break your logical designs. In some cases you may be able to get away with single layer.

          Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

          J Offline
          J Offline
          jboyd111
          wrote on last edited by
          #4

          Christian, Yusuf, thanks for your timely and informative replies. I have 2 simple (hopefully) questions that come to mind based on your responses: - You are both saying create separate .dlls. You do NOT mean the .cs files that are created in Visual Studio when you create a .aspx page, correct? - I've been through a couple of "introductory" books on c# and they all seem to show the database access code occurring in the .aspx file. That figures if they're just trying to show you enough to get started. I'll poke around in codeproject a lot more but: what would be the best way you all recommend to learn to create web sites the right way, using .dlls? Thanks again for your informative replies! -- Jeff

          Y 1 Reply Last reply
          0
          • J jboyd111

            Christian, Yusuf, thanks for your timely and informative replies. I have 2 simple (hopefully) questions that come to mind based on your responses: - You are both saying create separate .dlls. You do NOT mean the .cs files that are created in Visual Studio when you create a .aspx page, correct? - I've been through a couple of "introductory" books on c# and they all seem to show the database access code occurring in the .aspx file. That figures if they're just trying to show you enough to get started. I'll poke around in codeproject a lot more but: what would be the best way you all recommend to learn to create web sites the right way, using .dlls? Thanks again for your informative replies! -- Jeff

            Y Offline
            Y Offline
            Yusuf
            wrote on last edited by
            #5

            jboyd111 wrote:

            You are both saying create separate .dlls. You do NOT mean the .cs files that are created in Visual Studio when you create a .aspx page, correct?

            - The .cs files modularize your code. In most cases If the class is big enough I put it in one .cs files, but if the class is small, then I combine logical classes together. - A dll is an assembly (or library) that contains certain functionality, for example Database layer Most books in programming jump into the topic in discussion they throw everything in one place. The idea is to teach the language not necessarily the design. So, take it with grain of salt. Here [^] are CP articles on design and strategy, should you need assistance don't hesitate to post your question in appropriate forum

            Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

            J 1 Reply Last reply
            0
            • Y Yusuf

              jboyd111 wrote:

              You are both saying create separate .dlls. You do NOT mean the .cs files that are created in Visual Studio when you create a .aspx page, correct?

              - The .cs files modularize your code. In most cases If the class is big enough I put it in one .cs files, but if the class is small, then I combine logical classes together. - A dll is an assembly (or library) that contains certain functionality, for example Database layer Most books in programming jump into the topic in discussion they throw everything in one place. The idea is to teach the language not necessarily the design. So, take it with grain of salt. Here [^] are CP articles on design and strategy, should you need assistance don't hesitate to post your question in appropriate forum

              Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

              J Offline
              J Offline
              jboyd111
              wrote on last edited by
              #6

              Thanks Yusuf. I knew what dlls vs source (.cs) files were, I just hadn't seen .dlls used in any of the web (.aspx) examples I came across. I'm still trying to find where the actual compiled code from my web projects go, but that's another thread. Thanks for the pointer to the Design and Architecture articles and info. That should keep me busy for awhile :-) -------- Jeff

              Y 1 Reply Last reply
              0
              • J jboyd111

                Thanks Yusuf. I knew what dlls vs source (.cs) files were, I just hadn't seen .dlls used in any of the web (.aspx) examples I came across. I'm still trying to find where the actual compiled code from my web projects go, but that's another thread. Thanks for the pointer to the Design and Architecture articles and info. That should keep me busy for awhile :-) -------- Jeff

                Y Offline
                Y Offline
                Yusuf
                wrote on last edited by
                #7

                jboyd111 wrote:

                I'm still trying to find where the actual compiled code from my web projects go, but that's another thread.

                Good question: In the case of dll you know where that goes. In the case of asp.net, the compiled code gets copied into framework temp folder which is located in %WinDir%\Microsoft.Net\Framework\%version%\Temporary ASP.NET Files\%ProjectName% where %windir% = windows directory (by default in XP c:\windows) %version% = Framework version (for example v2.0.50727) %projectname% = asp.net project

                Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

                J 1 Reply Last reply
                0
                • Y Yusuf

                  jboyd111 wrote:

                  I'm still trying to find where the actual compiled code from my web projects go, but that's another thread.

                  Good question: In the case of dll you know where that goes. In the case of asp.net, the compiled code gets copied into framework temp folder which is located in %WinDir%\Microsoft.Net\Framework\%version%\Temporary ASP.NET Files\%ProjectName% where %windir% = windows directory (by default in XP c:\windows) %version% = Framework version (for example v2.0.50727) %projectname% = asp.net project

                  Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

                  J Offline
                  J Offline
                  jboyd111
                  wrote on last edited by
                  #8

                  Yusuf, my friend, you are my new hero! Thanks for taking the time to answer such rudimentary questions from a "newbie" such as myself. --- Jeff

                  Y 1 Reply Last reply
                  0
                  • J jboyd111

                    Yusuf, my friend, you are my new hero! Thanks for taking the time to answer such rudimentary questions from a "newbie" such as myself. --- Jeff

                    Y Offline
                    Y Offline
                    Yusuf
                    wrote on last edited by
                    #9

                    It was real pleasure helping people like you. Feel free to post any further question you may have in appropriate forum. Good luck learning asp.net

                    Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

                    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