Advertisement

03.21.2008 at 12:12PM PDT, ID: 23260407
[x]
Attachment Details

C# insert records into a table

Asked by rcoast in Microsoft Visual C#.Net

I need to insert 10 records into a table. They are all slightly different.

What would be the best way?

Table
  ID int (autonumber)
  Person varchar(50)
  Amount money
  DateInserted datetime
 
Data
  John, $1.23, 1/2/2007
  Sally, $2.43, 1/3/2007
  Mark, $3.45, 1/6/2007
  Carol, $5.00, 1/1/2007
  Bob, $2.32, 1/1/2008
  etc...

Should I populate an array, walk through it, and call an insert statement for each?

Is there a better data type to use?

New to C#... could use this as an example. Thanks.Start Free Trial
Related Solutions: C# best data structure for this
[+][-]03.21.2008 at 12:28PM PDT, ID: 21182457

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.21.2008 at 12:39PM PDT, ID: 21182533

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.21.2008 at 12:44PM PDT, ID: 21182569

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.21.2008 at 12:59PM PDT, ID: 21182699

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C#.Net
Sign Up Now!
Solution Provided By: tgerbert
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.21.2008 at 01:04PM PDT, ID: 21182734

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906