这里我通过循环选择行数据表如何将数据库中的匹配记录填充到另一个数据表
我的代码:
for (int i = 0; i <= selectedrows.Rows.Count - 1; i++)
{
string date1 = selectedrows.Rows[i]["Date"].ToString();
System.DateTime dateexcel = System.DateTime.ParseExact(date1, "MM/dd/yyyy", CultureInfo.InvariantCulture);
//check select rows exists or not in DB
SqlCommand cmd = new SqlCommand("select * from UploadTable where Date='" + dateexcel+"'", con);
da = new SqlDataAdapter(cmd);
DBdt = new DataTable();
da.Fill(DBdt); // Here i need to fill all the rows matching in DB not a one row
}
谢谢