¤ Hi all,
¤
¤ i am using sqlbulkcopy to insert content to table, how will i get
¤ total rows inserted into table without using any eventing.
You can check the row count just before execution of the bulk copy and then check it immediately
after completion and take the difference (assuming no one else is inserting rows into the table).
¤ and is it possible to do bulk copy from sql table to csv file?
Not with the SQLBulkCopy class. However, you can use a SQL SELECT INTO statement to perform this
operation. Below is an example:
Dim TextConnection As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "E:\My
Documents\TextFiles" & ";" & _
"Extended
Properties=""Text;HDR=NO;""")
TextConnection.Open()
Dim TextCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Orders#txt] FROM
[Orders] IN '' [ODBC;Driver={SQL
Server};Server=(local);Database=Northwind;Trusted_Connection=yes];", TextConnection)
TextCommand.ExecuteNonQuery()
TextConnection.Close()
Paul
~~~~
Microsoft MVP (Visual Basic)