you'd still have to loop through each record and build up a huge sql
statment that would do the insert.
There are 2 problems with doing it this way, in my opinion:
1. The final sql statement would be huge for 1000 records. There might
even be problems trying execute a massive sql statement on the database.
2. I don't think you should do native sql statements on a database that is
allowing user input because you open yourself up to sql injection issues.
Therefore you'd have to parse each insert statement.
So, still reckon youre better off doing it the long way. Which, wouldn't
take too long anyway. The connection would only be open once while you loop
through the records and most of the time is taken up establishing the
connection.
Steve
"Natty Gur" <natty@dao2com.com> wrote in message
news:eD6Uzl9WDHA.2064@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi,
>
> You can use Bulk insert with command object.
>
> Sql = "insert into a values('0');insert into a values('1')";
> SqlCommand oCmd = new SqlCommand(Sql,oConnection);
> int i = oCmd.ExcecudeNonQuery();
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 34th Elkalay st. Raanana
> Israel , 43000
> Phone Numbers:
> Office: +972-(0)9-7740261
> Fax: +972-(0)9-7740261
> Mobile: +972-(0)58-888377
>
>
> *** Sent via Developersdex
http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]