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

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

?? ????? ??

??????

????????? ???? ?? ?? ???? ?? ???? ??????? ???? ???????? ?? ????????? ???? ?? ??? ??? OLE DB ????????? ???? ???? (.udl) ????? ?? ????? ???? ?? ??? ??? ADO.NETOleDbConnection???????? ???? ??????? ??????? ??????? ???? ?? ??? ????? ???? ???

OLE DB ????????? ???? ???? (.udl) ??????? ?? ????? ?? ?? OLE DB ???? ????? ?? ?????? ???? ?? ??? ????? ???? ???? ?? ?? ???? ActiveX ???? ???????? (ADO) ??????? ???????? ?? ???? ???? ?? ??? ?? ????????? ????? ?????? ????? ???? ??????? ???????? ??????? ?? .udl ????????? ?? ??? ????? ?? ??? ??? ????? ?????? ??? ????? ??? .Udl ????? ??? ??????ConnectionString??? ADO.NET ?? ???OleDbConnection???????? ???? ??????? ?? ?????? ???? ?? ??? ???????? ?? ????? ???? ????? ?? ??????? ???????? ?? ????????? ???? ?? ??? ??? ?????????? ?????????? ???????? ?? ?????? ??????? ???????? ??????? .udl ????? ?? ??? ????????? ???? ?? ??? ?????????

????? ???????, ?? .NET Framework ????? ????????? ?????????? ??? "OleDbConnection.ConnectionString ???" ???? ?? ?? ?? ??? ???? ?? ??? ?????????? ?? (?????????????????):
???? Microsoft ???? ???? (UDL) ?? ??????, ???? ?? ??? UDL ???? ?? ??? ??? ?????? ??????ConnectionString??????? ??? "????? ??? = myfile.udl"? ??? ?? ?? ???? UDL ??????? ???????? ??? ????????? ?? ??, ?? ???? ????? ?????? ??? ??? ??? ?? ???? UDL ????????? ????, ?? ??? ???OleDbConnection???????? ?? ??????? ???? ?? ???ConnectionString,ConnectionStringUDL ????? ?? ???? ???? ?? ??????? ?? ?????? ???? ??????? ???????? ?? ?????? UDLs ?? ??? ????? ???OleDbConnection???? ??? ?? ?? ???????? ?? ???????? ?? ???? ??????? ???ConnectionString?? does ???? ?????? ??? UDL ??????? ?? ???? ???

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

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

    ?? .udl ????? ?? ??? ???? ??? ???? SQL Server ??????? ?? ??? ????? ???? ??, ?? Microsoft Access 97 ?? 2000 ??????? ?? ?????? ???? ?? ??? ???????? ???? ?? ??? Microsoft OLE DB ??????? Jet 4.0 ?? ??? ?? ????? ?? ???? ??????? .udl ????? ????? ?? ??? ???? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
    189680ADO ?? ??? ???? ???? ??????? ?? ????? ???? ????
  2. ??? ??? ????? 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. ??? ?? ??? ???? ?? ?? ???ConnectionString?? ???OleDbConnection????????, ??? ?? ???? ???? ??? ?? ????? ??? ?? ?? ??? ???? ???? ????? ?? ????? .udl ????? ?? ?? ?? ??????? ?????
  5. ????????? ?? ?? ???? ????? Studio.NET ?????? ????????? ??????? (IDE) ?????? ?? ?????? ????? ????? ?? ??? ????????? ???? ?????, "??????? ???? ???????????!" ?? ????? ???? ?? ???OleDbConnection???????? .udl ????? ??? ??????? ??????? ??????? ???? ?? ??? ??????? ???????? ??????? ?? ????? ???? ??? ????? ???
  6. ?????? ????? ?? ?????? ???? ?? ????????? ?? ??? ???? ?? ??? ENTER ??????

??????

?? ???? ??? ???? ??????? ?? ???OleDbConnection.ConnectionString???, .NET Framework ????? ????????? ??????????? ?? ?????:
HTTP://MSDN.Microsoft.com/en-us/library/SYSTEM.DATA.OLEDB.oledbconnection.connectionstring.aspx
???????? ??????? ?? ???, ???? ?? ???? ?????? ?? ????? ?? ???? ?? Microsoft ???????? ??? ?????::
189680ADO ?? ??? ???? ???? ??????? ?? ????? ???? ????

???

???? ID: 308426 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft ADO.NET 1.1
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
??????: 
kbhowtomaster kbsystemdata kbmt KB308426 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??: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