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