다음을 통해 공유


SqlCeRemoteDataAccess.SubmitSql Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Submits SQL statements for execution on a database in Microsoft SQL Server on a remote server.

Public Sub SubmitSql( _
   ByVal sqlString As String, _   ByVal oledbConnectionString As String _)
[C#]
public void SubmitSql(stringsqlString,stringoledbConnectionString);
[C++]
public: void SubmitSql(String* sqlString,String* oledbConnectionString);
[JScript]
public function SubmitSql(
   sqlString : String,oledbConnectionString : String);

Parameters

  • sqlString
    Any SQL statement that does not return rows.
  • oledbConnectionString
    The OLE DB connection string for the remote SQL Server database.

Remarks

The InternetUrl property must contain the URL of the SQL Server CE Server Agent.

The InternetLogin and InternetPassword properties must be specified if the SQL Server CE Server Agent is configured to use Basic or Integrated Windows authentication.

If SQL Server Authentication is used, the user ID specified in oledbConnectionString must have the authority to read the SQL Server table.

If Windows Authentication is used by setting INTEGRATED SECURITY="SSPI" in oledbConnectionString, the Internet user must have the authority to read the SQL Server table. The following identifies the Internet user based on the authentication method:

  • When Microsoft Internet Information Services (IIS) virtual directory is configured to use Anonymous access, the Internet user runs under the identity of the Internet Guest Account (IUSR computername). If you configure another Windows user account as the Internet Guest Account, the Internet user runs under the identity of that account.
  • When IIS virtual directory is configured to use Basic authentication, the Internet user runs under the identity of the Windows user account for which the client supplied the Internet user name and password.
  • When IIS virtual directory is configured to use Integrated Windows authentication, the Internet user runs under the identity of the Windows user account for which the client supplied the Internet user name and password.

Example

 
' 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.SubmitSql("MyLocalTable", rdaOleDbConnectString)

Catch e As SqlCeException
'Use you own Error Handling Routine.
'ShowErrors(e);
Finally
   'Dispose of the RDA Object.
   rda.Dispose()
End Try

[C#] 

        // 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.SubmitSql("MyLocalTable", rdaOleDbConnectString); 
        }
        catch(SqlCeException) {
            //Use you own Error Handling Routine.
        }
        finally {
            //Dispose of the RDA Object.
            rda.Dispose();
        }

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: .NET Compact Framework

.NET Framework Security:

See Also

SqlCeRemoteDataAccess Class | SqlCeRemoteDataAccess Members | System.Data.SqlServerCe Namespace