使用循环插入多个值 [英] inserting multiple values using looping

查看:82
本文介绍了使用循环插入多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用循环在表中插入多行,

i想要这样设计

sub1 sub2

mon hindi eng

tues eng math

thu数学历史

how i can insert multiple rows in a table using loop,
i want to design like this
day sub1 sub2
mon hindi eng
tues eng math
thu math history

推荐答案

这将取决于很多因素,例如你的信息来自哪里?和表数据将去哪里?但基本表非常简单:

That is going to depend on a heck of a lot of factors, like "where is your information coming from?" and "where is the table data going to go?" but the basic table is pretty easy:
DataTable dt = new DataTable();
dt.Columns.Add("day");
dt.Columns.Add("sub1");
dt.Columns.Add("sub2");
dt.Rows.Add("mon", "hindi", "eng");
dt.Rows.Add("tues", "eng", "math");
dt.Rows.Add("thu", "math", "history");


这篇关于使用循环插入多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆