How to create sdf file programmatically




















I suppose the problem is in the ConnectionString. It should point to the valid instance of the master db as in the article you refer to. Make sure it is correct, and it should work. Since only master has default access to create a database. How can I with "code" create a new. Any suggestions? Asked By: Deukalion. Improve this answer. GvS GvS So in C code, I just use file operations to copy "model. I've edited my answer to include a solution for this also. Still think the copy will be the easiest and fastest.

Thanks for the answer! Is there an idiomatic way to include the. Dependees of my data model dll should ideally not need to know about this. Responding to my above comment: I guess an easy way is to link it into the dll as a resource. This way the model is conveniently stored inside the dll and doesn't require separate installation. For installation, it's easier, but it will make it more difficult to update only the database later. Show 1 more comment. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. Improve this question. Are you sure the Exception is thrown by that piece of code? If you get such a strange error, you will get the exact code line number in your strack trace. The Close is not required since you are using using. Add a comment. Active Oldest Votes. Exists "FooDatabase. Delete "FooDatabase. CreateCommand ; cmd. Improve this answer.

I worked on this thing a few years back, and i wanted to close the connection like in this try catch, finally method.



0コメント

  • 1000 / 1000