AccessDataSource.ConnectionString 속성

정의

Microsoft Access 데이터베이스에 연결하는 데 사용되는 연결 문자열을 가져옵니다.

public:
 virtual property System::String ^ ConnectionString { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public override string ConnectionString { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.ConnectionString : string with get, set
Public Overrides Property ConnectionString As String

속성 값

String

AccessDataSource 컨트롤에서 System.Data.OleDb .NET 데이터 공급자를 통해 Access 데이터베이스에 연결하는 데 사용하는 OLE DB 연결 문자열입니다.

특성

예외

ConnectionString 속성을 설정하려고 한 경우

예제

다음 코드 예제에 표시 하는 방법을 보여 줍니다.는 ConnectionString 의 속성을 AccessDataSource ASP.NET 웹 페이지의 컨트롤입니다.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
private void Page_Load(Object sender, EventArgs e) {
  Label1.Text = AccessDataSource1.ConnectionString;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <asp:AccessDataSource
        id="AccessDataSource1"
        runat="server"
        DataFile="Northwind.mdb">
      </asp:AccessDataSource>

      <asp:Label
        id="Label1"
        runat="server">
      </asp:Label>

    </form>
  </body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

  Label1.Text = AccessDataSource1.ConnectionString

End Sub 'Page_Load
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <asp:AccessDataSource
        id="AccessDataSource1"
        runat="server"
        DataFile="Northwind.mdb">
      </asp:AccessDataSource>

      <asp:Label
        id="Label1"
        runat="server">
      </asp:Label>

    </form>
  </body>
</html>

설명

합니다 AccessDataSource 컨트롤에만 사용할 수는 System.Data.OleDb .NET 데이터 공급자 및 연결 하는 문자열 AccessDataSource 사용 하 여가이 공급자에 따라 다릅니다. 따라서를 AccessDataSource 컨트롤은 같은 연결 문자열 설정을 노출 합니다 DataFile 속성, 속성 및 값을 사용 하 여 런타임에 연결 문자열을 구문은 ConnectionString 속성인 경우 설정.

적용 대상

추가 정보