how to add password to database while database is created

G

Guest

In following code,how to add password to database when databese is created.

SqlCeReplication rep=new SqlCeReplication(
@"http://GRWEBSERVER/virdir/sscesa20.dll",
"username","password",
"GRWEBSERVER",
"SCDATA_PDA",
"SCDATA_PDA_PUBLICATION",
"kasj1",
@"Data Source=\My Documents\aaa.sdf" );
try
{
if(!System.IO .File.Exists (@"\My Documents\aaa.sdf"))
{
rep.AddSubscription (AddOption.CreateDatabase );
}
rep.Synchronize() ;
MessageBox.Show("successful");
}
catch(SqlCeException ex)
{
DisplaySQLCEErrors(ex);
}
finally
{
rep.Dispose();
}

thx anyway
 
A

Alberto Silva - Mobile Devices MVP

You have to supply the password on the connection string (Data Source=\My
Documents\aaa.sd; Persist Security Info=False; Password =1234). Take a look
at SQL CE books online, there are also option for encrypting the database
and having the temp folder in an alternate location.
 

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