如何在紧凑型SQL数据库中插入数据的循环? [英] How to do a loop in inserting data in a compact SQL database?

查看:184
本文介绍了如何在紧凑型SQL数据库中插入数据的循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在c#和SQL上还是一个新手,我只想知道如何实际执行一个循环,以将相同的数据插入数据库.我需要将相同的数据插入到我的数据库中,总共需要5000次.有关其他信息,我正在使用SQL Compact Edition(.sdf)类型的数据库.在此先感谢您.(^ _ ^)

Hi there everyone, I''m quite new in c# and SQL and I just wanna know how to actually do a loop for inserting the same data into a database. I need to insert the same data into my database for a total amount of 5000 times. And for extra information, I''m using SQL compact edition (.sdf) type of database. Thanks in advance.(^_^)

推荐答案

使用少量Google搜索,您可能会找到问题的答案.但是无论如何,

With a little bit of Google search you could have found an answer to your question. But anyways,

int loopCount = 5000;
for (int i = 0; i < loopCount; i++)
{
  //Your DB insert code here
}


-OR-


-OR-

int counter = 0;
while (counter != loopCount)
{
  //Your DB insert code here
  counter++;
}



有关循环的更多信息,请检查以下链接:
循环教程1 [循环教程2 [



For more info on the loops check these links:
Loops Tutorial 1[^]
Loops Tutorial 2[^]

Good luck,
OI


这篇关于如何在紧凑型SQL数据库中插入数据的循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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