循环添加textbox的数据

{ for (int k = count + 1; k <= 3; k++)

{

string stra = "lblNamChn" + k.ToString;

string strb = "txtEmpno" + k.ToString;

TextBox TextBoxa = (TextBox)this.FindControl(stra);

TextBox TextBoxb = (TextBox)this.FindControl(strb);

if (!string.IsNullOrEmpty(TextBoxa.Text.Trim))

{ strSQL = "Insert Into TUTOR(tutor_type,tutor_emp_id,tutor_name,crs_num,cls_num,crt_user,crt_datetime)

Values

("; strSQL += "'" + ReplaceString(SelTutorType.SelectedValue) + "',";

strSQL += "'" + ReplaceString(TextBoxb.Text.Trim) + "',";

strSQL += "'" + ReplaceString(TextBoxa.Text.Trim) + "',";

strSQL += "'" + ReplaceString(lstCrsNum.SelectedValue) + "',";

strSQL += "'" + ReplaceString(txtClsnum.Text.Trim) + "',";

strSQL += "'" + Session("UserID") + "',";

strSQL += "'" + Strings.Format(Now(), "yyyy/MM/dd HH:mm:ss") + "')";

clsDbProcess.ExecuteSQL(Session("Server"), Session("Database"), strSQL); } } }

posted on 2009-05-15 18:01  风乔  阅读(342)  评论(0编辑  收藏  举报

导航