saifullah khan

saifullah khan

  • NA
  • 335
  • 300.9k

Insert into database through loop

Jul 18 2011 9:26 AM
I am using asp.net with c#
I have a confusion.see the below code.

while (itr.MoveNext())  //this loop will rotate 26 time coz the value of itr is 26
  {
  Hashtable quote = ((Hashtable)(itr.Current));
  Response.Write(("Quote Symbol:" + quote["symbol"]));
  Response.Write(("Title:" + quote["title"]));  //1
  Response.Write(("Time:" + quote["time"]));

  if ((fxfeed.getInterval() == 1))
  {
  if (fxfeed.getPrice().Equals("bid,ask"))
  {
  Response.Write(("Bid:" + quote["bid"]));
  Response.Write(("Ask:" + quote["ask"]));
  }
  else
  {
  Response.Write(("Price:" + quote["price"]));
  }
  }
  else
  {
  Response.Write(("Open:" + quote["open"]));  //2
  Response.Write(("High:" + quote["high"]));  //3
  Response.Write(("Low:" + quote["low"]));  //4
  Response.Write(("Close:" + quote["close"]));  //5
  }

as i commented that the while loop will rotate 26 times. so each time lines which are represented by number comments(//1,//2 etc) these will be printed on screen. it means the at the completion of the while loop 107 values will be printed(which are represented by comments numbers). i have a database and want to store those 107 values in 107 cols in a database table. so can somebody please tell me where to put the sql command to insert the data and what do i need to write in that command. please help me.



Answers (7)