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

?????? ????????? ?????? ?????????
???? ???????: 308426 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ????? ??????? ??? OLE DB ??????? ?????? ???????? (& .udl &) ?????? ????? ??????? ???? ?????? ???? ADO.NET OleDbConnection ????? ????? ????? ??????.

???? ????? OLE DB ??????? ?????? ???????? (& .udl &) ????? ?????? ????? ??????? ?? ??? ????? ????? ?????? ?????? ActiveX (ADO) ???????? ?? ??????? ????? ?????? OLE DB. ??? ??????? ??????? ????? ??????? ?? ????? ???? ??? ??? ?? ?????? .udl. ????? ?????? ??? ??? & .udl & ?? ??????? "?????_?????" ???? ADO.NET OleDbConnection ?????? ????? ??????? ???? ??? ????????? ?? ??? ?????? ??????? ?????? ??????. ??????? ????? ??? ????? ?? ????? ??????? ?????? ??? ????? & .udl & ???? ????? ??? ??????? ????? ???????.

?? ????? ?????? ????????? ??????? ???? ??? ??? ?? ??????? "OleDbConnection.ConnectionString ?????" ?? ????? ????? ?????? ???? ??? .NET (???? ??? "References):
?????? ?????? ???????? Microsoft "(UDL) ? ??? ????? ???? ??? UDL ??? ?????_????_??????? ?? ???????" ??? ????? = myfile.udl ". ??? ?? ????? UDL ???? ?? ???? ?? ????? ???????, ??? ????? ??????? ?????? ???. ??? ??? ?????? UDL ???? ??? ??????? ???? OleDbConnection ???????? ?????_????_????????????_????_??????? ????? ??? ?????? ??? ??? UDL ??? ??????? ?????. ??? ????? ????? ????? ????? UDLs ?? ??? ??? ???? ??? OleDbConnection. ???? ?? ???? ??? ??? ?????? ? ???? ?????_????_??????? ?? ???? ??? UDL.

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

???? ??????? ??????? ?????? Visual C# ".NET ???? ?????? ?????" ?????? ??? & .udl ?????? ??????? ????? ??????? ???? ADO.NET OleDbConnection:
  1. ??????? SQL Server ???? OLE DB ??????? ????? ????? ?????? Microsoft SQL Server ????? ?? ?????? ??? & .udl & ???? Test.udl ?? ?????? ????? ?? ???? ??????? C.

    ????? ????? ??????? ???? Microsoft OLE DB ?? Jet 4.0 ?????? ??? .udl ??????? ?? Microsoft Access 97 ?? ????? ?????? 2000 ??? ?? ??? ???? ?? ?????? ??? ????? ?????? SQL Server.?????? ??? ??????? ?????? ??? ????? ????? ??? & .udl & ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
    189680????? ??????? ????? ?????? ???????? ???????? ADO
  2. ???? Visual C# ".NET ???? ?????? ?????" ????.
  3. ??????? ????? ????????? ?? ?????? ??????? Class1 ???????? ???????? ???????:
    using System;
    using System.Data;
    using System.Data.OleDb;
    
    namespace DataLink
    {
        class Class1
        {
            static void Main(string[] args)
            {
                OleDbConnection myConnection = new OleDbConnection("File Name = d:\\test.udl");
    
                try
                {
                    myConnection.Open();
                    if (myConnection.State == ConnectionState.Open)
                        Console.WriteLine("Connection opened successfully!");
                    else
                        Console.WriteLine("Connection could not be established");
                }
                catch(Exception ex)
                {
                    Console.WriteLine(ex.Message.ToString());
                }
                finally
                {
                    myConnection.Close();
                }
                Console.ReadLine();
     
                return;
            }
        }
    }
    					
  4. ?? ??????? ???? ???? ?????? ??????? "?????_?????" ?????? OleDbConnection ?????? ?????? ??? ????? & .udl & ??? ????? ???? ????? ?? ????? ??? ???? ???.
  5. ????? ??????? ?? ???? Visual Studio.NET Integrated ????? ???? (IDE). ??? ??? ???? ???? ???? ? ??? ???? ? "????? ??? ?????!" ??????? ??? ?? ?????? OleDbConnection ?? ?????? ??? ??????? ??????? ????? ??????? ?? ????? & .udl ?????? ????? ????? ????????.
  6. ???? ????? "???????" ?????? ???? ???? ?????? ?????? ???????.

?????

????? ?? ????????? ??? ??????? OleDbConnection.ConnectionString ???? ????? ????? ?????? ???? ??? .NET ???????:
http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.connectionstring.aspx
?????? ??? ??????? ??????? ???? ??? ??? ??????? ????? ?????? ?? "????? ??????? ?? Microsoft:
189680????? ??????? ????? ?????? ???????? ???????? ADO

???????

???? ???????: 308426 - ????? ??? ??????: 26/????? ??????/1425 - ??????: 3.4
????? ???
  • Microsoft ADO.NET 1.0
  • Microsoft ADO.NET 1.1
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
????? ??????: 
kbmt kbhowtomaster kbsystemdata KB308426 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????308426

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

 

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