Getting started with SqlLocalDB Want to create databases and tables

I have a new Win11 machine. I installed SQL Server express. I used SqlLocalDB to start the default instance: Name: MSSQLLocalDB Version: 14.0.1000.169 State: Running
Now, how can I create databases, from this point? I can write C# apps to create tables, add and query data, etc. but I figure I need to have databases existing to connect to them programatically. So I would need to be able to create some databases first. If that can be done programatically before I even have an .mdf file, what would be the connection string?

Thank you,
Jon

You should be able to launch SQL Server Management Studio and connect to your server to create Database and DB Objects

1 Like

Thank you, but
I have not purchased SQL Server Management Studio.

When you have installed LocalDB a master database is created. You can use the master database to create a new database.

You can use this page for more information:

Create a SQL Server Database programmatically - C# | Microsoft Learn

I thought there was a version that came with express? If not, you can download it. I believe it's free

2 Likes

@mike01. Thanks. I selected your link, but it was not express, but the full SSMS. I am not ready to lay out the $$. I had previously found a link for the free, express version, but it was old and would not install on my win11 computer
@RogierPronk. Thank you very much. I will try out that code. It looks promising.
Jon

@JonJacobs Management Studio (SSMS ) is $free. JUst download ver 18 or 19 . No job agent with Express though

2 Likes

I tried to install SSMS. First the latest 20.2 and got setup failed. It said to restart computer first. I did, same result. I went with 19.3. Same result. Fatal error during installation (0x80070643) I can give info from log file if that will help. I looked up the error number and it shows Windows Update Error, which makes no sense for the context.