初始化 SqlCeRemoteDataAccess 对象的新实例,并将其配置为在访问 Microsoft Internet 信息服务 (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 连接字符串。
注释
此构造函数初始化 InternetUrl、InternetLogin、InternetPassword 和 LocalConnectionString 属性。将对其余的属性分配默认值。然后可以更改任何属性的值。
示例
' 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();
}