how to add password to database while database is created

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top