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
  1. Home
  2. General Programming
  3. C#
  4. Database Code Generator

Database Code Generator

Scheduled Pinned Locked Moved C#
databasecsharptutorial
18 Posts 7 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.
  • M mfcuser

    I haven't read the article, but what I did, I passed it to another string. For example, stringName = textBox.Txt; I don't see the difference

    P Offline
    P Offline
    Paul Conrad
    wrote on last edited by
    #9

    mfcuser wrote:

    stringName = textBox.Txt; I don't see the difference

    That is still dangerous. Read Colin's article that Pete referred to :)


    Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

    M 1 Reply Last reply
    0
    • P Paul Conrad

      mfcuser wrote:

      stringName = textBox.Txt; I don't see the difference

      That is still dangerous. Read Colin's article that Pete referred to :)


      Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

      M Offline
      M Offline
      mfcuser
      wrote on last edited by
      #10

      Now, I will start to use databinding rather than getting user input directly

      C P 2 Replies Last reply
      0
      • M mfcuser

        Now, I will start to use databinding rather than getting user input directly

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #11

        There is nothing wrong with getting user input directly if you sanitise it (which you will still need to do with databinding) and use parameterised queries. See the article, it explains how to go from injecting values directly into a SQL Statement to using parameterised queries.


        Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

        1 Reply Last reply
        0
        • M mfcuser

          Now, I will start to use databinding rather than getting user input directly

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #12

          mfcuser wrote:

          I will start to use databinding rather than getting user input directly

          It's not a matter of how you get the user input, but a matter of what the user inputs into the text box that is the security concern. Like Colin said in his post below, you still need to sanitize the input.


          Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

          M 1 Reply Last reply
          0
          • P Paul Conrad

            mfcuser wrote:

            I will start to use databinding rather than getting user input directly

            It's not a matter of how you get the user input, but a matter of what the user inputs into the text box that is the security concern. Like Colin said in his post below, you still need to sanitize the input.


            Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

            M Offline
            M Offline
            mfcuser
            wrote on last edited by
            #13

            Assume that I use DataBindings with a textbox to update a table. I assume that I don't need to use the INSERT INTO sql statement.

            M C 2 Replies Last reply
            0
            • M mfcuser

              Assume that I use DataBindings with a textbox to update a table. I assume that I don't need to use the INSERT INTO sql statement.

              M Offline
              M Offline
              mfcuser
              wrote on last edited by
              #14

              I still have a problem with sanitization. Assume that the user is going to insert or update a field from a table. The user types something on the textbox. The word or phrase the user types can be anything like "word, letter, number, especial charater or a mixture". There is no way I can determine that in advance. So how can I sanitize that?

              P 1 Reply Last reply
              0
              • M mfcuser

                I still have a problem with sanitization. Assume that the user is going to insert or update a field from a table. The user types something on the textbox. The word or phrase the user types can be anything like "word, letter, number, especial charater or a mixture". There is no way I can determine that in advance. So how can I sanitize that?

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #15

                Use parameterized queries as stated in Colin's article and you don't have to worry about doing it, the parameterized query will do this behind the scenes for you. It may be extra coding to do the parameterized queries but it is worth it from a security stand point.


                Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

                M 1 Reply Last reply
                0
                • P Paul Conrad

                  Use parameterized queries as stated in Colin's article and you don't have to worry about doing it, the parameterized query will do this behind the scenes for you. It may be extra coding to do the parameterized queries but it is worth it from a security stand point.


                  Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon

                  M Offline
                  M Offline
                  mfcuser
                  wrote on last edited by
                  #16

                  I was just thinking about that. This is what I will do before passing the data.

                  1 Reply Last reply
                  0
                  • M mfcuser

                    Assume that I use DataBindings with a textbox to update a table. I assume that I don't need to use the INSERT INTO sql statement.

                    C Offline
                    C Offline
                    Colin Angus Mackay
                    wrote on last edited by
                    #17

                    mfcuser wrote:

                    Assume that I use DataBindings with a textbox to update a table. I assume that I don't need to use the INSERT INTO sql statement.

                    Yes, you will. How else is it going to get into the database? All the databinding and funky wizards that Visual Studio provides hide a lot of the actual functionality. You shuould take a look at the code the wizards produce. It isn't the nicest thing to read (generated code often isn't - neither is it to be considered a good way to code either) but it will teach you a fair bit about what is going on under the hood.


                    Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

                    P 1 Reply Last reply
                    0
                    • C Colin Angus Mackay

                      mfcuser wrote:

                      Assume that I use DataBindings with a textbox to update a table. I assume that I don't need to use the INSERT INTO sql statement.

                      Yes, you will. How else is it going to get into the database? All the databinding and funky wizards that Visual Studio provides hide a lot of the actual functionality. You shuould take a look at the code the wizards produce. It isn't the nicest thing to read (generated code often isn't - neither is it to be considered a good way to code either) but it will teach you a fair bit about what is going on under the hood.


                      Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

                      P Offline
                      P Offline
                      Paul Conrad
                      wrote on last edited by
                      #18

                      Colin Angus Mackay wrote:

                      look at the code the wizards produce. It isn't the nicest thing to read

                      Yep, that sure is the truth :)


                      If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa

                      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