Need example how to build SQL database in C#
Need example how to create new local database and a connection开发者_StackOverflow中文版 string, if possible with a using statement.
There should be 1 table and the data that I want to put in there are unique words length 2-50 lowercase characters, and thy can contain "a-zõäöüšž", ordered by ascending.
There are 2 actions I want to do with that:
- Put HashSet of string called words in
- Get HashSet of string called words that are specific length
Optionally, I could use an example how to reduce amount of answers given by Get, by telling what letter x must be or what it can not be in a specific location within length of word.
Edit Found my answer by Google.
In terms of creating databases and schemas from code (C# and MS SQL Server), I have sample code here:
How to create "embedded" SQL 2008 database file if it doesn't exist?
you can do all using code, but I would recommend that you ship at least one empty SQL 2008 Express database (mdf file) in your program.
and use the normal Connection String
I did stop shipping SQL Express and only use SQLite now. It's fast and fantastic to use as settings keeper and much more, and I stop having problems in installing this and that on client side to support MS SQL stuff.
I use this on both windows and web apps.
I am not sure I understand your question but you can use SQL Server Compact Edition (SQL ServerCE) as a local database.
You can deal with it as if you are using SQL Server but with the namespace SqlServerCe instead of SqlClient.
精彩评论