c# - I have stored Table fields and Textbox values in two different list<string> now I want to use those lists in insert query how to do it? -
i have stored table fields , textbox values in 2 different list<string>
.
i want use lists in insert query how ? , quotation marks if value numeric ?
foreach (control txt_name in tb_list) { string txtname = txt_name.text; string field_name = txt_name.name.substring(3); field_name.add(field_name); tb_name.add(txtname); } sqlcommand cmd = new sqlcommand("insert "+ table_name + "('"+ field_name + "') values('" + tb_name + "')", con);
table field must separated commas. value field must treated in different ways. example: string values want single quote before , after value, int doesn't.. best way handle insert statement sql procedure.
Comments
Post a Comment