SqlCeRemoteDataAccess 构造函数 (String, String)
初始化 SqlCeRemoteDataAccess 对象的新实例,并相应地配置它,使它能够匿名访问 Microsoft Internet 信息服务 (IIS)。
命名空间: System.Data.SqlServerCe
程序集: System.Data.SqlServerCe(在 system.data.sqlserverce.dll 中)
语法
声明
Public Sub New ( _
internetUrl As String, _
localConnectionString As String _
)
用法
Dim internetUrl As String
Dim localConnectionString As String
Dim instance As New SqlCeRemoteDataAccess(internetUrl, localConnectionString)
public SqlCeRemoteDataAccess (
string internetUrl,
string localConnectionString
)
public:
SqlCeRemoteDataAccess (
String^ internetUrl,
String^ localConnectionString
)
public SqlCeRemoteDataAccess (
String internetUrl,
String localConnectionString
)
public function SqlCeRemoteDataAccess (
internetUrl : String,
localConnectionString : String
)
不适用。
参数
- internetUrl
连接到 SQL Server Compact Edition Server Agent 时使用的 URL。
- localConnectionString
SQL Server Compact Edition 数据库的 OLE DB 连接字符串。
备注
此构造函数初始化 InternetUrl 和 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/sscesa20.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/sscesa20.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();
}
平台
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。
版本信息
.NET Framework
受以下版本支持:3.0
.NET Compact Framework
受以下版本支持:2.0、1.0
请参见
参考
SqlCeRemoteDataAccess 类
SqlCeRemoteDataAccess 成员
System.Data.SqlServerCe 命名空间