Question How to edit SQL Local Database in Visual Studio

daveofgv

Well-known member
Joined
Sep 17, 2008
Messages
218
Location
Dallas, TX
Programming Experience
1-3
Hi All -

I have a quick question.......

I created a Windows Form Application in VB.NET (Visual Studio 2010 Ultimate) - I added a new item "local database" and when I added the columns and saved a table - I went back into the table schema and I see that I cannot change a column after saving the table.

I can add columns but cannot change one that is already in there. Is there a way to do this?

Also, as a side note, Is "local database" the best database to use in a commercial product - where it will only be accessed by one user at a time (not server). - Debating between local database ".sdf" file versus access databse.

Thanks in advanced.
 
Last edited:
You can change the table schema but only certain changes are allowed. If you try to change the data type of a column to a new type where data of the old type could not be converted, the change will not be allowed. If you want to make a change that is not allowed then what you'll have to do is create a new column and then delete the old one, possibly copying any existing data across yourself.

I would choose a SQL Server CE database over an Access database.
 
Thank you jmchilhinney.

SQL Server CE database is already in Visual Studio correct? This is the "local database" that I choose in Add - New, correct.
 
Thank you jmchilhinney.

SQL Server CE database is already in Visual Studio correct? This is the "local database" that I choose in Add - New, correct.

If you choose Local Database then it creates a SQL Server CE SDF file and if you choose a Server-based Database then it creates a SQL Server MDF file. The MDF file requires that you have SQL Server Express installed to attach the database at run time but the SDF file doesn't require a server. You do need some DLLs though, so your end user's must either have SQL Server CE installed or, more likely, you distribute the appropriate DLLs with your app.
 
Back
Top