Click here to Skip to main content
11,484,162 members (69,914 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
Any one can help me...........
i want to insert data in multiple rows in one table in a c# windows Application
in one insert command.

my insert command is......
insert into timetable values('day1','sub1','sub2','sub3'), insert into timetable values('day1','sub1','sub2','sub3')
when i run this command it geves error like missing semecolon(;) in end of statement
Posted 10-Jan-13 1:20am
Edited 10-Jan-13 1:46am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

insert into timetable values('day1','sub1','sub2','sub3') insert into timetable values('day1','sub1','sub2','sub3')

Just do multiple insert statements in one command.
  Permalink  
Comments
Member 8006143 at 10-Jan-13 6:35am
   
one eroor is occoured missing semicolon(;) at and of statement
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,


You can do it , you said you have a multiple records set of data right..?
then you do one thing you store that data into one datatable.
and check the for/ foreach condition inside for condition you write your insert query .

EX:


DataTable dt= //ur data;
for(int i=0;i<dt.rows.count;i++)>
{
    // ur insert query;
}
  Permalink  
Comments
Member 8006143 at 10-Jan-13 6:35am
   
i am inserting first time in the table

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 210
1 Frankie-C 155
2 Raje_ 155
3 OriginalGriff 147
4 Maciej Los 110
0 Sergey Alexandrovich Kryukov 8,489
1 OriginalGriff 7,943
2 Sascha Lefèvre 3,114
3 Maciej Los 2,581
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100