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. question on for loop

question on for loop

Scheduled Pinned Locked Moved ASP.NET
tutorialquestionhelp
3 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
    sunita ramesh
    wrote on last edited by
    #1

    hi all, I have a labelbox and a text box.its ids are label1 and text1.Similarly i have 75 label and text boxes.I need to insert those values(by row by row) in table. string std= "insert into Example Values('"+Label1.ID+"','" + text1.text+ "')"; Similarly i need to insert 75 values. how to do that using for loop? Plz help me Thanks in Advance Sunita ramesh

    N R 2 Replies Last reply
    0
    • S sunita ramesh

      hi all, I have a labelbox and a text box.its ids are label1 and text1.Similarly i have 75 label and text boxes.I need to insert those values(by row by row) in table. string std= "insert into Example Values('"+Label1.ID+"','" + text1.text+ "')"; Similarly i need to insert 75 values. how to do that using for loop? Plz help me Thanks in Advance Sunita ramesh

      N Offline
      N Offline
      Navi15
      wrote on last edited by
      #2

      1.create a function which takes values to be inserted as arguments in databse to insert rows, and call that function. *2. create a function which takes a string as argument and decodes that string into individual set of values to be inserted into the table. (ex)if the table has 2 columns 'column1 value',column2 value'|'column1 value',column2 value'|'column1 value',column2 value'|'column1 value',column2 value'....... in the sp get the substring seperated by | and insert into the table in a loop. this method is recomented as it will reduce the number of calls to the databse(we only call the SP once) Navi

      1 Reply Last reply
      0
      • S sunita ramesh

        hi all, I have a labelbox and a text box.its ids are label1 and text1.Similarly i have 75 label and text boxes.I need to insert those values(by row by row) in table. string std= "insert into Example Values('"+Label1.ID+"','" + text1.text+ "')"; Similarly i need to insert 75 values. how to do that using for loop? Plz help me Thanks in Advance Sunita ramesh

        R Offline
        R Offline
        Ramasubramaniam
        wrote on last edited by
        #3

        Hi, 1) Construct an XML file from the front end (ASP.NET). 2) Pass the XML file as a parameter to an Stored Procedure. 3) Write an SP to read the Values from the XML and insert into table. Sample Insert query to read from xml in SP Insert into table1(field1,field2,field3,....,field75) Select * from OpenXml(@intPointer,'/XML1/XML2',2) With (field1 char(6),field2 char(3),field3 char(15),......,field75 char (8) ) Advantages: ========== 1) No need to create 75 parameters. 2) SP creation is very simple and easy to maintain. Ram

        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