SqlCeRemoteDataAccess.Pull Method Problem

  • Thread starter Thread starter Poohface
  • Start date Start date
P

Poohface

I'm having an issue pulling from a SQL server to my compact app. My
code is as follows:

//////////////////////
Inherits System.Windows.Forms.Form
Friend WithEvents Calllist As System.Windows.Forms.ListBox
Friend WithEvents btRefresh As System.Windows.Forms.Button
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
'Local ConString
Private strConLocal As String =
"Provider=Microsoft.SQLSERVER.OLEDB.CE.2.0;Data Source=\My
Documents\accu.sdf"
'Remote ConString
Private strConRemote As String = "provider=sqloledb;user
id=(REMOVED);password=(REMOVED);data source=(REMOVED);initial
catalog=(REMOVED);persist security info=True"
'URL String for SQLce connection
Private strURL As String =
"http://(REMOVED)/(REMOVED)/sscesa20.dll"

Private Sub btRefresh_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btRefresh.Click


Try
Dim rdaAccu As New SqlServerCe.SqlCeRemoteDataAccess
rdaAccu.LocalConnectionString = strConLocal
rdaAccu.InternetUrl = strURL
rdaAccu.Pull("Cust", "Select Name from Customer Where
StatusID = 1", strConRemote)
rdaAccu.Dispose()
Catch exsql As SqlServerCe.SqlCeException
Dim strError As String
strError = exsql.NativeError.ToString
MsgBox(strError & " - " & exsql.Message.ToString,
MsgBoxStyle.Exclamation, "POOF!")
Debug.WriteLine(strError & " - " & exsql.Message.ToString)
End Try

End Sub
/////////////////////////

The error I'm getting is:
28567 - The table cannot be opened [,,,Table name,,]

What I've checked so far.
I've made the accu.sdf DB via the SQLCEQuery tool, just a plain DB
with a name, no password or encryption. No tables are currently in it.
So the table "Cust" that I want to pull to does not exist already as
per the pull methods documentation.
(localTableName
The name of the SQL Server CE table that will receive the extracted
SQL Server records. An error occurs if the table already exists. )

I'm confidant in my connection to the db as far as connection strings
and I'm able to browse to the DLL and get the expected response from
the server. I'm not sure where I've gone wrong. Any help would be
great.

Thanks,
Norst
 
Specify an ErrorTableName with Pull and look up the ErrorTable to identify
the cause of the problem.

You can access SQL Server CE Knowledge Base articles at:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;KBHOWTO
( select ' SQL Server CE ' as the product )

Thank you!
Syed N. Yousuf
Microsoft Developer Support Professional

This posting is provided "AS IS" with no warranties, and confers no rights.
 
I'm sorry you lost me a bit there. I did a search for 'SQL Server CE
28567' and it turned up nothing. I don't know what you mean by
'Specify an ErrorTableName with Pull and look up the ErrorTable'

Norst
 
Ok, it turns out the problem was actually on the SQL Server side. The
login I was using in my Connection String did not have the proper read
premissions set for the database table. The error had me looking on
the CF side of things. Thanks for the help and I hope this helps
others in the future.

Norst
 
Back
Top