Click here to Skip to main content
15,923,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can thee CREATE DB command be executed succesfully against sql server ce?If yes, can username and password be specified during the exection?


I have never heard of anyone I know executing the CREATE DB command.Is it really executabe?Can password and username be specified during its execurion?What conditions must be met in order to execute it?
Posted

Since the SqlCE connection string must include a filename (which is the database) it is difficult to see how you would execute CREATE DB: but the MSDN documentation insists you can: http://technet.microsoft.com/en-us/library/ms174454.aspx[^]

But...you don't realy need it: and empty (zero byte) file opened with the connection string is a valid (if empty) database file.
 
Share this answer
 
Comments
Gbenbam 28-Feb-14 9:11am    
Do you mean that if at run time I use writefile to create an empty file with a .sdf extension, that means I have a new database?Kindly expansiate on it.
What about the username and password issue, how does one secure the "new database"
OriginalGriff 28-Feb-14 9:38am    
Yes. An empty SDF file is a valid SQLCE database.
Then use the Compact method:
http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact(VS.80).aspx
I use the SqlCeEngine to CreateDatabase:

http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine(v=vs.100).aspx[^]

Adding users, I haven't tried yet.


It appears that you can't create users in SQL Server CE
http://msdn.microsoft.com/en-us/library/ms171955.aspx[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900