TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raj
NA
3
0
Optimize database insertion
Oct 6 2009 1:21 PM
Hi, all.
I had a question about optimizing the insertion of many records into a SQL Server Compact Edition database. Basically, I'm grabbing a set of data from an Oracle database using an OracleDataReader object and adding it to the SSCE database. I'm looping through the items in my datareader object (dr) as follows:
while (dr.Read())
{
string studio = dr["STUDIO"].ToString().Trim();
string view_dt = dr["VIEW_DT"].ToString().Trim();
string series = dr["SERIES"].ToString().Trim();
string clip_or_episode = dr["CLIP_OR_EPISODE"].ToString().Trim();
string imps_estimated = dr["IMPS_ESTIMATED"].ToString().Trim();
string video_title = dr["VIDEO_TITLE"].ToString().Trim();
string asset_id = dr["ASSET_ID"].ToString().Trim();
string series_cat = dr["SERIES_CAT"].ToString().Trim();
string content_start_cnt = dr["CONTENT_START_CNT"].ToString().Trim();
dwAssetsTableAdapter.Insert(studio, DateTime.Parse(view_dt), series, clip_or_episode, long.Parse(imps_estimated), video_title, long.Parse(asset_id), series_cat, int.Parse(content_start_cnt));
}
This takes about 3.5 minutes for ~3k records, which is painfully slow since I will probably need to process tens of thousands at a time. What can I do to make this go faster? Shouldn't this take seconds? Also, I'm a bit of a neophyte when it comes to C# and programming in general, so some generalized code examples would be greatly appreciated with any advice. Thanks in advance for your help!
Reply
Answers (
2
)
C# Database value, assembly and other errors. Please Help.
simple datatype query