Creating a loop that will edit 60 TextBox names?

前端 未结 4 1158
傲寒
傲寒 2021-01-26 05:27

text box set1 = 1 to 30 = in the query name = br1id to br30id

textbox set 2 = 1 to 30 = in the result output

i dont understand how to create a loop based on 30

4条回答
  •  隐瞒了意图╮
    2021-01-26 05:58

    Yes to all previous answers, (600 textboxes? 600 for Ids and 600 more for the query results?) but if you really want to do this, as a technique, also change the SQL to:

    StringBuilder sb = new StringBuilder(
             "SELECT brukernavn From bruker where ID In (");
    foreach(Textbox tb in IdTextboxes)  sb.Append(tb.Text + ",");  
    string SQL = sb.ToString(0,sb.Length - 1) + ")";
    
    MySqlConnection mysqlCon = 
         new MySqlConnection("server=195.225.0.218; " +
              "Database = bruker; user id=huggy; password=LoLOW;");   
    cmd1 = new MySqlCommand(SQL, mysqlCon);   
    

提交回复
热议问题