|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SqlBulkCopy problemI am developing C# project, using ADO .NET 2.0 to connect to SQL Server 2005. I created a DataTable from scratch, and then use SqlBulkCopy to insert it into an empty table in a SQL Server 2005 table. The datatable I created from scratch matches exactly the empty SQL Server 2005 table. However, when this runs I get the error: Exception {"OLE DB provider 'STREAM' for linked server '(null)' returned invalid data for column '[!BulkInsert].MyField. "} System.Exception {System.Data.SqlClient.SqlException} But for SQL Server 2000 everything is OK! Could you please give me a hint how to fix the problem? Thanks, GB "GB" <v7v***@hotmail.com> wrote in message news:rxFmg.82061$771.53222@edtnps89...Show quote > Hello: Hmm. I don't know. Try creating your DataTable using a DataAdapter with a > I am developing C# project, using ADO .NET 2.0 to connect to SQL Server > 2005. > I created a DataTable from scratch, and then use SqlBulkCopy to insert it > into an empty table in a SQL Server 2005 table. > The datatable I created from scratch matches exactly the empty SQL Server > 2005 table. > > However, when this runs I get the error: > > Exception {"OLE DB provider 'STREAM' for linked server '(null)' > returned > invalid data for column '[!BulkInsert].MyField. "} System.Exception > {System.Data.SqlClient.SqlException} > > But for SQL Server 2000 everything is OK! > > Could you please give me a hint how to fix the problem? > query of the form select * from MyTable where 1=2 Then ADO.NET will build the matching DataTable for you. At least you can see if there is any difference between that DataTable and the one you manufactured from scratch. David |
|||||||||||||||||||||||