Click here to Skip to main content
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 0:20am
Edited 10-Jan-13 0: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)



Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
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