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. Web Development
  3. ASP.NET
  4. INSERT QUERY

INSERT QUERY

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorial
11 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.
  • S Offline
    S Offline
    sachees123
    wrote on last edited by
    #1

    Frnds, I have got 200 varibles, that i want to insert in database. Im confused, how to do that.. HELP!!!!

    C 1 Reply Last reply
    0
    • S sachees123

      Frnds, I have got 200 varibles, that i want to insert in database. Im confused, how to do that.. HELP!!!!

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

      Contact your client, tell them you are stealing from them. Seriously, if you are confused at this basic a level, you should choose more simple tasks and work through them until you have enough experience to take on tasks like this. You insert them with SQL, there's really no other way. You can use transactions, if you want to make it all or nothing, apart from that, that's all there is. this also has NOTHING to do with ASP.NET.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      S 1 Reply Last reply
      0
      • C Christian Graus

        Contact your client, tell them you are stealing from them. Seriously, if you are confused at this basic a level, you should choose more simple tasks and work through them until you have enough experience to take on tasks like this. You insert them with SQL, there's really no other way. You can use transactions, if you want to make it all or nothing, apart from that, that's all there is. this also has NOTHING to do with ASP.NET.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        S Offline
        S Offline
        sachees123
        wrote on last edited by
        #3

        Dear, I stored my 200 values in an array and that 200 values represent one record. It is easy to insert 'n' record, that i did N no. of times with MAX of 20 values but this is first time im supposed to insert this large no. of values. So donno how to do... Im trying... may be it take some time.... but i will find that... THATS SURE.

        C B 2 Replies Last reply
        0
        • S sachees123

          Dear, I stored my 200 values in an array and that 200 values represent one record. It is easy to insert 'n' record, that i did N no. of times with MAX of 20 values but this is first time im supposed to insert this large no. of values. So donno how to do... Im trying... may be it take some time.... but i will find that... THATS SURE.

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

          sachees123 wrote:

          I stored my 200 values in an array and that 200 values represent one record.

          OK, so you need one SQL statement, one insert. The syntax is the same, although if you have 200 values in one record, it seems likely that your database design is a disaster.

          sachees123 wrote:

          Im trying...

          What have you tried ? It really helps us to see what you've tried, as well as telling us that you HAVE tried to do more than to ask here. Tell us what you did, what the error is, what is going wrong, then we're more likely to offer help based on what you tell us. I still don't see the issue, tho, an insert is an insert. Why do you have 200 records ? Like I said, that sounds like a terrible design to me.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          S 1 Reply Last reply
          0
          • S sachees123

            Dear, I stored my 200 values in an array and that 200 values represent one record. It is easy to insert 'n' record, that i did N no. of times with MAX of 20 values but this is first time im supposed to insert this large no. of values. So donno how to do... Im trying... may be it take some time.... but i will find that... THATS SURE.

            B Offline
            B Offline
            Blue_Boy
            wrote on last edited by
            #5

            Why you don't redesign database? Instead having 200 columns in one table, separate it and create some tables manage by relations between them.


            I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

            C 1 Reply Last reply
            0
            • B Blue_Boy

              Why you don't redesign database? Instead having 200 columns in one table, separate it and create some tables manage by relations between them.


              I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

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

              Yes. that's kind of what I said.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              B 1 Reply Last reply
              0
              • C Christian Graus

                sachees123 wrote:

                I stored my 200 values in an array and that 200 values represent one record.

                OK, so you need one SQL statement, one insert. The syntax is the same, although if you have 200 values in one record, it seems likely that your database design is a disaster.

                sachees123 wrote:

                Im trying...

                What have you tried ? It really helps us to see what you've tried, as well as telling us that you HAVE tried to do more than to ask here. Tell us what you did, what the error is, what is going wrong, then we're more likely to offer help based on what you tell us. I still don't see the issue, tho, an insert is an insert. Why do you have 200 records ? Like I said, that sounds like a terrible design to me.

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                S Offline
                S Offline
                sachees123
                wrote on last edited by
                #7

                Actully i have an OMR sheet that contain 200 questions and that 200 response is for one person/sheet. So dont think the database design is a DISASTER. Now wat i tried is ...... my mind is not working... the one time effort is to write all those 200 variables. but i want some simple method and im sure there is....some simple method... to do this sort of job. And that too with an array..

                C 1 Reply Last reply
                0
                • S sachees123

                  Actully i have an OMR sheet that contain 200 questions and that 200 response is for one person/sheet. So dont think the database design is a DISASTER. Now wat i tried is ...... my mind is not working... the one time effort is to write all those 200 variables. but i want some simple method and im sure there is....some simple method... to do this sort of job. And that too with an array..

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

                  sachees123 wrote:

                  Actully i have an OMR sheet that contain 200 questions and that 200 response is for one person/sheet. So dont think the database design is a DISASTER.

                  I think it is. I think you need to store questions and answers in a format that allows for you to easily add and remove questions, instead of having to change your DB to do so.

                  sachees123 wrote:

                  Now wat i tried is ...... my mind is not working... the one time effort is to write all those 200 variables. but i want some simple method and im sure there is....some simple method... to do this sort of job. And that too with an array..

                  OK, I see. Well, if your values in your array are in the same order they are in the DB, you can loop through the array and add the items, building SQL in a loop. Of course, this will leave you open for SQL injection attacks, but if you can't be bothered writing a stored proc or paramaterised query, then that seems to be the solution you are asking for.

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  S 1 Reply Last reply
                  0
                  • C Christian Graus

                    Yes. that's kind of what I said.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    B Offline
                    B Offline
                    Blue_Boy
                    wrote on last edited by
                    #9

                    Yes,If I am in his/her place then sure I'm gonna redesign maybe all database maybe too including software application.


                    I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

                    1 Reply Last reply
                    0
                    • C Christian Graus

                      sachees123 wrote:

                      Actully i have an OMR sheet that contain 200 questions and that 200 response is for one person/sheet. So dont think the database design is a DISASTER.

                      I think it is. I think you need to store questions and answers in a format that allows for you to easily add and remove questions, instead of having to change your DB to do so.

                      sachees123 wrote:

                      Now wat i tried is ...... my mind is not working... the one time effort is to write all those 200 variables. but i want some simple method and im sure there is....some simple method... to do this sort of job. And that too with an array..

                      OK, I see. Well, if your values in your array are in the same order they are in the DB, you can loop through the array and add the items, building SQL in a loop. Of course, this will leave you open for SQL injection attacks, but if you can't be bothered writing a stored proc or paramaterised query, then that seems to be the solution you are asking for.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      S Offline
                      S Offline
                      sachees123
                      wrote on last edited by
                      #10

                      MAN, I DID it and in a very simple way.... as i told u... mail me ... if u wanna know... but no doubt... thanks a lot for replying me... thanks

                      C 1 Reply Last reply
                      0
                      • S sachees123

                        MAN, I DID it and in a very simple way.... as i told u... mail me ... if u wanna know... but no doubt... thanks a lot for replying me... thanks

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

                        Well, the way I suggested was simple. Your database design still sucks, however.

                        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                        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