???? ????? ??? ??? ??????? ??? SqlBulkCopy ???? ???????? ?? ???? ??? ???? ?????? ?? .NET Framework 2.0: "System.InvalidOperationException: ??? ?? ?????? ??? ??????? ????? ??? ???? ?????? ??????"

?????? ????????? ?????? ?????????
???? ???????: 944389 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

?? ??? ??????? Microsoft .NET Framework 2.0 ??????? ??? SqlBulkCopy ???? ???????? ?? System.Data.DataTable ??? ???? ?? Microsoft SQL Server. ????? ??? ?????? ??? ??? ???? (.) ? ???? ????? ????? ???????:
?? System.InvalidOperationException ?? ??? ???????
????? = "??? ?????? ??? ??????? ????? ?????? ?? ?????? ??????. ??? ?? ??? ?????? ?? ????? ???????? ??????? ??? ?? ???? ?????? ????? ???????? ??? ????? ???????? (??? ???? ?????? [mydb]..[mytable](??? ???? ?????? [mydb]..[mytable]); ????? ??? ????? ??? ??????? ??????? (#mytable ??? ???? ?????? ?? ???? ??????? ??? ???? tempdb..#mytable). "
Source="System.Data"

?????

???? ??? ??????? ???? ????? ?? System.Data.dll ?????.

???? ??????

?????? ??? ??? ??????? ?? ???? ???? ???? (.) ?? ????? ???????.

??? ??? ?? ??????? ??????? ??? ???? (.) ?? ??? ???? ??????? ??? ?????? (.) ???? ?? ?????? ??????? SQL. ??? ???? ??????? ???????? ??? ???? ?????? ??? ???:
server.database.schema. tablename

?????

???? Microsoft ?? ??? ????? ?? ?????? Microsoft ??????? ?? ??? "????? ???".

??????? ????

????? ????? ????? ??????

  1. ?? ????? ?????? Northwind ????? ????? SQL ???????: ???
    select * into [test.33] where 1 = 0
    --Create a table named [test.33].
    
  2. ????? ????? Visual C# ?? ?? ?????? ????????? ???????? ???????:
    static void Main(string[] args)
            {
                SqlConnection con = new SqlConnection("Integrated Security=SSPI;Initial Catalog=Northwind;Data Source=.");
                con.Open();
                SqlConnection dst = new SqlConnection("Integrated Security=SSPI;Initial Catalog=Northwind;Data Source=.");
                dst.Open();
                SqlCommand com = new SqlCommand("select * from customers", con);
                SqlDataReader dr = com.ExecuteReader();
                SqlBulkCopy sbc = new SqlBulkCopy(dst);
                sbc.DestinationTableName = "Northwind.dbo.[Test.33]";
                sbc.WriteToServer(dr); // The failure occurs here.
                dst.Close();
                con.Close();
            }
    

??????? ???? ????????

at System.Data.SqlClient.SqlBulkCopy.AnalyzeTargetAndCreateUpdateBulkCommand(BulkCopySimpleResultSet internalResults)
       at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal()
       at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount)
       at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader)

???????

???? ???????: 944389 - ????? ??? ??????: 24/?? ?????/1428 - ??????: 2.1
????? ???
  • Microsoft .NET Framework 2.0
  • Microsoft .NET Framework 3.0
  • Microsoft .NET Framework 3.5
????? ??????: 
kbmt kbexpertiseadvanced kbtshoot kbprb KB944389 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????944389

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com