+ 1

Does anyone know how to add .sdf file from Visual Studio 2017?

I cant seem to find a built in local database .sdf whenever im trying to add a new file from my project. does anyone know? any help will be appreciated. thank you in advance.

30th Dec 2017, 4:05 PM
eli
15 Respostas
+ 1
Hi Eli, thanks for the information Is see Correction, .sdf is a c# file or better. .sdf is the sql server compact edtion file .mdf is the sql server file. Let me clarify your question You created a .sdf-database And now you want to add that database to a c# project In the video you have see how to create a new database but this video does not explain how to add an existing database to your project.
30th Dec 2017, 9:39 PM
sneeze
sneeze - avatar
+ 3
A sdf file is not a c# file. It is a sql server file. You need a sql server to connect to the database. Hope you have sql server or download sql express this it is free. https://www.microsoft.com/en-us/download/details.aspx?id=55994 Use a sqlconnection in your c# code. https://www.dotnetperls.com/sqlconnection
30th Dec 2017, 4:36 PM
sneeze
sneeze - avatar
+ 1
ok i'll try this one. ive followed some tutorial the video taught to add a new file in the project by right clicking the project and adding a local database file as far as i understood it is the built in local database from visual studio here is the reference: https://youtu.be/1EpYqtSlOr8
30th Dec 2017, 5:23 PM
eli
+ 1
I read quickly to this article http://www.sokhawin.com/how-to-open-sql-compact-edition-file-sdf-in-visual-studio-or-linqpad/ It looks like the sql compact edition is no longer in use. Is there a specially reason for you to want to use the sdf file format?
30th Dec 2017, 10:29 PM
sneeze
sneeze - avatar
+ 1
you are welcome, keep asking questions.
30th Dec 2017, 10:32 PM
sneeze
sneeze - avatar
+ 1
The last video is far more up to date than the first one. Please find SQL Server Management Studio on your computer and try to find out what your server name is. Either create a database in SQL sever Management studio and connect to it via sqlconnection or enter the computer name and server name manually https://stackoverflow.com/questions/26559840/visual-studio-not-showing-server-name-when-adding-connection
30th Dec 2017, 10:52 PM
sneeze
sneeze - avatar
+ 1
Alright! Hope it works im feeling excited about it! Thanks a lot sneeze!
30th Dec 2017, 11:06 PM
eli
0
thanks sneeze by the way
30th Dec 2017, 5:23 PM
eli
0
Yeah. I wanted to follow the video tutorial but I cant seem to find the file he wanted me to add (.sdf) it's probably because he is using an older microsoft visual studio. and i am using visual studio express 2017. I dont know yet if the .sdf file template can be downloadable. if it is obsolete on visual studio 2017. i'll try to follow on the article you have linked. just wanted to try the built in local database to practice and try the feature. Thanks for your help sneeze i appreciate it. let me know if i need to clarify something. thanks again
30th Dec 2017, 10:22 PM
eli
0
oh i see. good to know. thanks a lot sneeze. i will give you an update once i got it working
30th Dec 2017, 10:30 PM
eli
0
...and one more thing, earlier when i got stuck i tried to follow this another video tutorial, because i was a little bit hopeless and i feel stuck. i saw this video, i followed all the instruction the only thing i didnt follow is that he wanted me to download the sql server 2016 and instead i downloaded the sql server 2017. i have installed the smss and everything i just cant seem to connect the sql server to my visual studio. when i try to add a new database sql thing on Server Explorer Tab here is the reference: https://youtu.be/OdDkFPO_nto this is only 12 min video i think.
30th Dec 2017, 10:36 PM
eli
0
i got lost at the video at 3:52 min. because i cant see my server name whenever i try to click the dropdown menu. it is blank
30th Dec 2017, 10:39 PM
eli
0
sneeze it worked! thank you so much! happy new year!
2nd Jan 2018, 7:20 PM
eli
0
Well done and a happy New Year
2nd Jan 2018, 9:11 PM
sneeze
sneeze - avatar
0
Their are two local databases, one comes with visual studio, sqllocaldb.exe (c:\program files\Microsoft SQL server\thisvaries\sqllocaldb.exe) this file is needed on programs computer. Then there is (local database) option that nobody has this option that opens a SQL compact file .sdf and no SQL files are required.
7th Apr 2019, 11:00 PM
David Morrow
David Morrow - avatar