BUG: ????? ??????? GetSchemaTable ?????? SqlDataReader ??? ?????? ??? ????

?????? ????????? ?????? ?????????
???? ???????: 307512 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

???????

????? ??????? GetSchemaTable ?????? SqlDataReader ??????? ? ??? BaseServerName ?????? BaseCatalogName. ??? ???? ??? SqlDataReader.GetSchemaTable ????? BaseCatalogName ???.

?????

???????? ??? ??????? ???? ?? ????? ?? Microsoft .NET Framework ??? ????? ????? ?????? ??????? (SDK) ??????? ? SqlDataReader.GetSchemaTable ????? ???? ?????? BaseServerName. BaseServerName ?? ??? ???? Microsoft SQL Server ???? ?????? SqlDataReader. ???? BaseServerName ??? BaseCatalogName ?? DataTable ??? ?????? ????? ??????.

????

???? ?? ???? ??? ??????? ?? ???? OleDbDataReader ? ????? ??????? OleDbDataReader ?????? ??? ??????? SchemaTable.

?????

???? Microsoft ?? ??? ??? ?? Microsoft ???????? ??????? ?? ????? ??? ???????.

??????? ????

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

???????? Visual Basic .NET

  1. ???? Microsoft Visual Studio .NET ?? ????? ????? Visual Basic ????? ???? ???? ????.
  2. ?? ?????? ????????? ???????? ??????? ???? "?????? ??????? 1 ?????? ???????":
    Imports System.Data.SqlClient
    					
  3. ?? ?????? ???????? ???????? ??????? ??? ????? Sub Main():
    Dim cnNwind As New SqlConnection("Data Source=ServerName;user id=username;" & _
                                     "Password=password;Initial Catalog=Northwind;")
            Dim cmd As New SqlCommand("Select * from Customers", cnNwind)
            cnNwind.open()
    
            Dim dr As SqlDataReader
            dr = cmd.ExecuteReader
            Dim i As Integer
            For i = 0 To dr.GetSchemaTable.Columns.Count - 1
    
            System.Console.WriteLine(dr.GetSchemaTable.Columns(i).ColumnName)
    
            Next
            System.Console.Read()        
            dr.Close()
            cnNwind.Close()
    					
  4. ????? ????? ??????? ??? ?????? ?? Microsoft SQL Server.
  5. ???? ??????? F5 ????? ??????? ???????. ???? ?? ???? ??????? SchemaTable ???? ?? ???? ???? ??????. ???????? ??? ???? ???? BaseServerName ????? ???? ??? BaseCatalogName.

???????? Visual C# .NET

  1. ?? ?????? Visual Studio .NET ?? ????? ???? Visual C# .NET ??????? "????? ???? ??????".
  2. ????? ????????? ???????? ??????? ??? Class1 ??? ????? ????? ConsoleApplication1:
    using System.Data;
    using System.Data.SqlClient;
    					
  3. ?? ?????? ???????? ???????? ??????? ??? ????? ????? (????? ????? []) ????? ????:
    SqlConnection cnNwind = new SqlConnection("Data Source=servername;user id=username;
                                              Password=password;Initial Catalog=Northwind;");
            SqlCommand cmd = new SqlCommand("Select * from Customers", cnNwind);
    	
            cnNwind.Open();
    
            SqlDataReader dr ;
    
    			dr = cmd.ExecuteReader();
    			DataTable dt = dr.GetSchemaTable();
    				for (int i=0;i<dt.Columns.Count;i++)
    				{
    					System.Console.WriteLine(dt.Columns[i]);
    				}
    				System.Console.Read();
    
                                    dr.Close();
                                    cnNwind.Close();
    			
    					
  4. ????? ????? ??????? ??? ?? ????? ?? SQL ?????? ?? ???????.
  5. ???? ??????? F5 ????? ??????? ???????. ???? ?? ???? ??????? SchemaTable ???? ?? ???? ???? ??????. ???????? ??? ???? ???? BaseServerName ????? ???? ??? BaseCatalogName.

???????? Visual C++ .NET

  1. ?? ?????? Visual Studio .NET ?? ????? Visual .NET C++ ??????? "????????? ???????".
  2. ?? ?????? ????????? ???????? ??????? ??? ??????? _tmain(void) Int:
    #using <System.dll>
    #using <System.Data.dll>
    
    using namespace System;
    using namespace System::Data;
    using namespace System::Data::SqlClient ;
    					
  3. ?? ?????? ???????? ???????? ??????? ??? ?????-tmain(void) Int:
    SqlConnection *cnNwind = new SqlConnection("Data Source=servername;user id=username;
                                               Password=password;Initial Catalog=Northwind;");
        SqlCommand *cmd = new SqlCommand("Select * from Customers", cnNwind);
    		 cnNwind->Open();
    
            SqlDataReader *dr ;
    		
    			dr = cmd->ExecuteReader();
    			DataTable *dt = dr->GetSchemaTable();
    			int i;
    			for (i=0;i<dt->Columns->Count;i++)
    				{
                                     Console::WriteLine(dt->Columns->Item [i]);
    				}
    				System::Console::Read();
    				dr->Close();
    				cnNwind->Close();
    			
                                    return 0;
    					
  4. ????? ????? ??????? ??? ?? ????? ?? SQL ?????? ?? ???????.
  5. ???? ??????? F5 ????? ??????? ???????. ???? ?? ???? ??????? SchemaTable ???? ?? ???? ???? ??????. ???????? ??? ???? ???? BaseServerName ????? ???? ??? BaseCatalogName.

???????? Visual J# .NET

  1. ???? Microsoft Visual Studio .NET ?? ????? ????? ??????? Visual J# "???? ????" ????.
  2. ?? ?????? ????????? ???????? ??????? ??? class1:
    import System.Data.*;
    import System.Data.SqlClient.*;
    					
  3. ?? ?????? ????????? ???????? ??????? ??? ?????:
    	SqlConnection cnNwind = new SqlConnection("Data Source=servername;user id=username;Password=password;Initial Catalog=Northwind;");
    		SqlCommand cmd = new SqlCommand("Select * from Customers", cnNwind);
    	
    		cnNwind.Open();
    
    		SqlDataReader dr ;
    
    		dr = cmd.ExecuteReader();
    		DataTable dt = dr.GetSchemaTable();
    		for (int i = 0; i < dt.get_Columns().get_Count(); i++)
    		{
    			DataColumnCollection dcc = dt.get_Columns();
    			System.Console.WriteLine(dcc.get_Item(i));
    		}
    		System.Console.Read();
    	
    		dr.Close();
    		cnNwind.Close();
    					
  4. ????? ????? ??????? ??? ?? ????? ?? SQL ?????? ?? ???????.
  5. ???? ??????? F5 ????? ??????? ???????. ???? ?? ???? ??????? SchemaTable ???? ?? ???? ???? ??????. ???????? ??? ???? ???? BaseServerName ????? ???? ??? BaseCatalogName.

???????

???? ???????: 307512 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 1.18
????? ???
  • Microsoft ADO.NET 2.0
  • Microsoft ADO.NET (included with the .NET Framework)
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual C++ .NET 2002 Standard Edition
  • Microsoft Visual C++ .NET 2003 Standard Edition
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft Visual J# .NET 2003 Standard Edition
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 2.0
  • Microsoft Visual Basic 2005
  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C# 2005
  • Microsoft Visual J# 2005 Express Edition
????? ??????: 
kbnosurvey kbarchive kbmt kbtshoot kbvs2002sp1sweep kbbug kbpending kbreadme kbsqlclient kbsystemdata KB307512 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????307512

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

 

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