Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 problem when using sqlbulkcopy()

Author  Topic 

sundarsrini_s
Starting Member

6 Posts

Posted - 2008-06-10 : 05:25:30
hi!

i am using bulkcopy() function to export the data from excel file to datatable through asp.net.but if there is any column having both number and text then the numbers are exported as null to the datatable.

here is my coding:

Dim sSQLTempTable As String = "sqltemp"
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sSqlActConnection)
bulkCopy.DestinationTableName = sSQLTempTable
bulkCopy.WriteToServer(OleDbrdr)


for example

field1 field2

1 text1
2 56
3 text2
4 78
5 98

when i export like these, the records in datatable are:

field1 field2

1 text1
2 null
3 text2
4 null
5 null

why it export as null?

reg,
s.srini
   

- Advertisement -