共用方式為


SqlCeRemoteDataAccess 建構 (String, String, String, String)

初始化 SqlCeRemoteDataAccess 物件的新執行個體並進行設定,以便對 Microsoft Internet Information Services (IIS) 進行基本驗證或整合式 Windows 驗證。

命名空間:  System.Data.SqlServerCe
組件:  System.Data.SqlServerCe (在 System.Data.SqlServerCe.dll 中)

語法

'宣告
Public Sub New ( _
    internetUrl As String, _
    internetLogin As String, _
    internetPassword As String, _
    localConnectionString As String _
)
'用途
Dim internetUrl As String
Dim internetLogin As String
Dim internetPassword As String
Dim localConnectionString As String

Dim instance As New SqlCeRemoteDataAccess(internetUrl, _
    internetLogin, internetPassword, _
    localConnectionString)
public SqlCeRemoteDataAccess(
    string internetUrl,
    string internetLogin,
    string internetPassword,
    string localConnectionString
)
public:
SqlCeRemoteDataAccess(
    String^ internetUrl, 
    String^ internetLogin, 
    String^ internetPassword, 
    String^ localConnectionString
)
new : 
        internetUrl:string * 
        internetLogin:string * 
        internetPassword:string * 
        localConnectionString:string -> SqlCeRemoteDataAccess
public function SqlCeRemoteDataAccess(
    internetUrl : String, 
    internetLogin : String, 
    internetPassword : String, 
    localConnectionString : String
)

參數

  • internetUrl
    型別:System. . :: . .String
    用於連接到 SQL Server Compact 3.5 伺服器代理程式的 URL。
  • internetLogin
    型別:System. . :: . .String
    連接到 SQL Server Compact 3.5 伺服器代理程式時使用的登入名稱。
  • internetPassword
    型別:System. . :: . .String
    連接到 SQL Server Compact 3.5 伺服器代理程式時使用的密碼。
  • localConnectionString
    型別:System. . :: . .String
    SQL Server Compact 3.5 資料庫的 OLE DB 連接字串。

備註

此建構函式會初始化 InternetUrlInternetLoginInternetPasswordLocalConnectionString 屬性。其餘的屬性則會指派成它們的預設值,接著您就可以變更任何屬性的值。

範例

' Connection String to the SQL Server.
Dim rdaOleDbConnectString As String = _
    "Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " + _
    "User Id=username;Password = <password>"

' Initialize RDA Object.
Dim rda As SqlCeRemoteDataAccess = Nothing

Try
    'Try the Pull Operation.
    rda = New SqlCeRemoteDataAccess()

    rda.InternetLogin         = "MyLogin"
    rda.InternetPassword      = "<password>"
    rda.InternetUrl           = "<http://www.northwindtraders.com/sqlce/sscesa35.dll>"
    rda.LocalConnectionString = "Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf"

    rda.Pull("Employees", "Select * from Employees", _
       rdaOleDbConnectString, _
       RdaTrackOption.TrackingOnWithIndexes, _
       "ErrorTable")

Catch e As SqlCeException
'Use you own Error Handling Routine.
'ShowErrors(e);
Finally
   'Dispose of the RDA Object.
   rda.Dispose()
End Try
// Connection String to the SQL Server.
string rdaOleDbConnectString  = "Provider=sqloledb; Data Source=MySqlServer;Initial Catalog=Northwind; " +
                                "User Id=username;Password = <password>"; 

// Initialize RDA Object.
SqlCeRemoteDataAccess rda = null;

try {
    //Try the Pull Operation.
    rda = new SqlCeRemoteDataAccess();

    rda.InternetLogin          = "MyLogin";
    rda.InternetPassword       = "<password>";
    rda.InternetUrl            = "<http://www.northwindtraders.com/sqlce/sscesa35.dll>";
    rda.LocalConnectionString  = @"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\ssce.sdf";

    rda.Pull(
        "Employees", 
        "Select * from Employees", 
        rdaOleDbConnectString, 
        RdaTrackOption.TrackingOnWithIndexes , 
        "ErrorTable");
}
catch(SqlCeException) {
    //Use you own Error Handling Routine.
}
finally {
    //Dispose of the RDA Object.
    rda.Dispose();
}

請參閱

參考

SqlCeRemoteDataAccess類別

SqlCeRemoteDataAccess 成員

SqlCeRemoteDataAccess 多載

System.Data.SqlServerCe 命名空間