Ergent - RDA Problems

G

Guest

private void RDAPull(

if (!System.IO.File.Exists(@"\My Documents\MSFA.sdf")

//File.Delete("MSFA.sdf")
SqlCeEngine eng = new SqlCeEngine(@"Data Source=\My Documents\MSFA.sdf")
eng.CreateDatabase()

SqlCeConnection cn = new SqlCeConnection(@"Data Source =\My Documents\MSFA.sdf")
SqlCeCommand cmd = new SqlCeCommand("DROP TABLE Customer", cn)
cn.Open()
tr

cmd.ExecuteNonQuery()

catch(Exception){
cn.Close()
cn.Dispose()
SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess()

string sCon = @"Provider=SQLOLEDB; DataSourve=MySvr;
+ @"Initial Catalog=MSFA;integrated security=SSPI;
+ @"Persist Security Info=False"
rda.InternetUrl = @"http://MySvr/MSFA/sscesa20.dll"
rda.LocalConnectionString = @"Data Source =\My Documnets\MSFA.sdf"
tr

rda.Pull("Customer", "SELECT * FROM Customer", sCon, RdaTrackOption.TrackingOn, "rdaCustomerErrors")

catch (Exception e ){e.ToString();
rda.Dispose()



Above is the code for pull the table from SQL Server 2000 database to SQL Server CE database. Does it correct ??
I've few questions here about RDA

1. In the "string sCon" how to know what should put at data source ??. Is it Initial Catalog is the database name ?
for integrated security, is it must specify ?? If let say I does not use SSPI, How should I code it ?? Is it like
integrated security = ""

2. I use SQL Server Connectivity Management Tool to create a virtual directory contaning the SQL Server CE Server Agent DDL (Sscesa20.dll
I've choose to use integrated windows authendication, so for NTFS Access Permission User I put HONG\leong Yau Hong, where HONG is my computer nam
na dleong yau hong is my windows user account. After the Installation finish, does it means also I've succefully install th
SQL Server CE Server Agent on my Web server ?

3. By default, the SQL Server CE Server Agent is locate at "c:\Program Files\Microsoft SQL Server CE 2.0\Server\"
Is it this is the directory I should put in above code - "rda.InternetUrl ??

4. How to know that the SQL Server CE Agent is install on my Web Server. For your information, I use "IIS" as Web Server is it ok ?
I right click my computer, click manage, then it display "Computer Management". I expand Services and Applications I see Microsoft SQL Server CE folder
Besides, I also expand the "Internet Information Service", expand WebSites and Default Web Site, I saw the Folder that I specify at Virtual Directory Alias and Content
Folder in SQL Server CE Virtual Diractory Creation Wizard

5. Can RDA work on Emulator ?

6. If I wnat to pull more than one table, let say "Catalog" table, is it I just put below code ?

rda.Pull("Customer", "SELECT * FROM Customer", sCon, RdaTrackOption.TrackingOn, "rdaCustomerErrors")
rda.Pull("Catalog", "SELECT * FROM Catalog", sCon, RdaTrackOption.TrackingOn, "rdaCatalogErrors")

7. Last Question, Normally Where should I place the RDAPull code ?? Is it at FormLoad or at Constructor ?

Thanks very muc
 
M

Matteo Cima

Hong said:
private void RDAPull()
{
if (!System.IO.File.Exists(@"\My Documents\MSFA.sdf"))
{
//File.Delete("MSFA.sdf");
SqlCeEngine eng = new SqlCeEngine(@"Data Source=\My Documents\MSFA.sdf");
eng.CreateDatabase();
}
SqlCeConnection cn = new SqlCeConnection(@"Data Source =\My Documents\MSFA.sdf");
SqlCeCommand cmd = new SqlCeCommand("DROP TABLE Customer", cn);
cn.Open();
try
{
cmd.ExecuteNonQuery();
}
catch(Exception){}
cn.Close();
cn.Dispose();
SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess();

string sCon = @"Provider=SQLOLEDB; DataSourve=MySvr;"
+ @"Initial Catalog=MSFA;integrated security=SSPI;"
+ @"Persist Security Info=False";
rda.InternetUrl = @"http://MySvr/MSFA/sscesa20.dll";
rda.LocalConnectionString = @"Data Source =\My Documnets\MSFA.sdf";
try
{
rda.Pull("Customer", "SELECT * FROM Customer", sCon,
RdaTrackOption.TrackingOn, "rdaCustomerErrors");
}
catch (Exception e ){e.ToString();}
rda.Dispose();
}
}

Above is the code for pull the table from SQL Server 2000 database to SQL
Server CE database. Does it correct ??
I've few questions here about RDA:

It's correct, but the connectionstring is not perfect:
here's what i use in my projects:

string rdaOleDbConnectionString = "Provider=sqloledb;" +
"data source=" +sqlServerNameAndInstance +";" + // eg:
pcname\\instance
"Initial Catalog="+ sqlDbName + ";" + // "master" or your own db
"User Id=XXX;"+
"Password=XXX";


i see you use "DataSourve" instead of "DataSourCe" maybe also that can lead
to problems :)

MySvr is supposed to be your pcname and instancename, in the form
server\instancename ... you can see it in the tooltip of sqlserver service
manager in the trayarea.

1. In the "string sCon" how to know what should put at data source ??. Is
it Initial Catalog is the database name ??
for integrated security, is it must specify ?? If let say I does not
use SSPI, How should I code it ?? Is it like:
integrated security = "";

2. I use SQL Server Connectivity Management Tool to create a virtual
directory contaning the SQL Server CE Server Agent DDL (Sscesa20.dll)
I've choose to use integrated windows authendication, so for NTFS
Access Permission User I put HONG\leong Yau Hong, where HONG is my computer
name
na dleong yau hong is my windows user account. After the Installation
finish, does it means also I've succefully install the
SQL Server CE Server Agent on my Web server ??
3. By default, the SQL Server CE Server Agent is locate at "c:\Program
Files\Microsoft SQL Server CE 2.0\Server\"
Is it this is the directory I should put in above code -
"rda.InternetUrl ??

rda.interneturl is always the complete http path to sscesa20.dll
to test it i go to that url on my desktop pc (just type
http://MySvr/MSFA/sscesa20.dll in your ie addressbar), it should say that
the server is up (just a line of simple text)
and directly on my device i do the same... with that i am sure the device
can connect to my sqlserver
4. How to know that the SQL Server CE Agent is install on my Web Server.
For your information, I use "IIS" as Web Server is it ok ??
I right click my computer, click manage, then it display "Computer
Management". I expand Services and Applications I see Microsoft SQL Server
CE folder.
Besides, I also expand the "Internet Information Service", expand
WebSites and Default Web Site, I saw the Folder that I specify at Virtual
Directory Alias and Content
Folder in SQL Server CE Virtual Diractory Creation Wizard.

seems ok. You're supposed to use iis... i have no news of other webservers
running it.
5. Can RDA work on Emulator ??

i can't remember if i tryied... but, why not. Try to navifate to
http://MySvr/MSFA/sscesa20.dll from your emulator and see what it does...
if it does not, try to go to just http://MySvr and see if your webserver is
not accessible or the sqlserver integration is not running
6. If I wnat to pull more than one table, let say "Catalog" table, is it I just put below code ??

rda.Pull("Customer", "SELECT * FROM Customer", sCon,
RdaTrackOption.TrackingOn, "rdaCustomerErrors");
rda.Pull("Catalog", "SELECT * FROM Catalog", sCon,
RdaTrackOption.TrackingOn, "rdaCatalogErrors");

seems ok... try with tracking off for the first tests...
7. Last Question, Normally Where should I place the RDAPull code ?? Is it
at FormLoad or at Constructor ??

wherever you want... you can put it on a buttonclick event, if you want...

Thanks very much

you're welcome



--
Matteo Cima,
Senior Developer, Mobile Expert, Project Manager, Lead Analyst,
Dotnet, C# (Csharp) and Compact Framework Expert
Digisoft srl Italy
msn: matteodellamontagna_hotmail_com (you know what to do with those
underscores, don't you?)
 
G

Guest

Thanks "Matteo Cima" I just read your mail - 8.20 p.m (malaysia time) & I will try it out first and let you know if there is any problem thanks a lot.
 
G

Guest

If I use windows authentication, what should I put for the "User Id" & "Password" ?? Is it my windows account user name & login password ??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top