Created
October 26, 2013 17:05
-
-
Save AlexArchive/7171967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class BookmarksDatabase | |
| { | |
| public static string ConnectionString | |
| { | |
| get | |
| { | |
| return ConfigurationManager.ConnectionStrings["Bookmarks"].ConnectionString; | |
| } | |
| } | |
| public static void Initialize() | |
| { | |
| using (var engine = new SqlCeEngine(ConnectionString)) | |
| { | |
| // Returns false if the database cannot be found! | |
| if (engine.Verify() == true) | |
| { | |
| return; | |
| } | |
| engine.CreateDatabase(); | |
| using (var connection = new SqlCeConnection(ConnectionString)) | |
| { | |
| connection.Open(); | |
| connection.Execute("CREATE TABLE Bookmarks(BookmarkName nvarchar(200) PRIMARY KEY, BookmarkAddress nvarchar(200));"); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment