This is a pretty simple question, but I'm learning C# and I'm wondering if when you add a Local Database to your project (The book I'm using is Head First C#) if it's a SQL Server database or just an Access database (or something else).
I'm using just the Windows forms to add a database, and it's filling a bunch of columns in with the names/id's/etc of a database I filled out. It was super easy to do (I can see why people like C# now) But I didn't know if this was an actual SQL Server database you could do inserts/updates and such with. Or something else entirely.
I forgot to mention this is VS 2012 Express.
By default if you're using VS 2012, a LocalDB database will be created. With prior versions of Visual Studio, the database will be SQL Server Express.
Related
I am writing a console application using .NET 5, and I am using a LocalDB instance (at least I hope that's the right terminology) to store the data that the application needs. I can see the database (including both tables and all the data in said tables) in both the Server Explorer and SQL Server Object Explorer tabs of Visual Studio 2019, but the Data Sources tab the only thing that shows is the text "This window is not supported for the selected project."
The problem is, all the tutorials I've been able to find rely on that Data Sources tab. From looking at other questions here on Stack Overflow, it looks to me like that tab is deprecated with .NET 5? Am I correct? And how would I write the code to access the database and perform CRUD operations without the Data Sources tab?
Sorry if this is a stupid question; this is my first time using LocalDB.
You should use SQL Server Object Explorer. If you right click on the database that you want to connect, you can see the properties, including connection string. If you have trouble with incorporating Connection string into your code - you need to show the code and the problem.
Whether Data Sources is deprecated or not, as you can see it is not supported for most projects (I think it's just for Windows projects - but I may be wrong). Anyway - you don't need it. And by the way - this approach works regardless of the database you use (LocalDB, SQL Express or regular SQL Server)
How to embed a database to a WPF application?
scenario: this is our school project and we are required to create a
system with a database. now, i have done the fundamentals (create a
database, creating a layout and the c# code for programability) but
now, when we are to transfer the build onto a different computer, the
database seems to be lost.
I'm using Visual Studio 2015 with SQL Server for its database and that database is placed within the localdb of my computer. what i want is a portable system so that we can present the system anywhere without the hassle of bringing my desktop to school.
thanks in advance <3
EDIT: there are a ton of ways to connect a database to a wpf
application and i dont know what to choose. theres the ling-to-sql,
entity framework, data source etc. which of these methods will be the
best way for a portable application with the database in it.
my WPF app uses SQL Compact + Entity Framework (code first) + migrations, yo can find sources here https://github.com/tym32167/arma3beclient
All database-related things placed in this project https://github.com/tym32167/arma3beclient/tree/master/src/Arma3BE.Client.Libs
Data context here https://github.com/tym32167/arma3beclient/blob/master/src/Arma3BE.Client.Libs/Context/Arma3BEClientContext.cs
Migrations here https://github.com/tym32167/arma3beclient/tree/master/src/Arma3BE.Client.Libs/Migrations
This is coming from a 15 year veteran of Delphi who has taken a State Job where Visual Studio 2010 C# is used.
So how do I see data at design time? It seems to elude me. At least it does not seem possible on the surface.
TIA...
You can use SQL Server Object Explorer or Server Explorer to view or modify database structure and data at design time.
Here is a good article series about SSDT (SQL Server Data Tools) which in linked article trains working with SQL Server Object Explorer.
Basic question is how to create custom menu items in Object Explorer in Sql Server Management Studio ?
Actually what I want to implement is create menu item which will perform as:
Create CRUD stored procedures for the table on which the user had done right-click.
Possibly other stuff like remove duplicate records.
The executing module could be external written in C#.NET
I have checked SSMS Addins but I think it is different than what I am looking for.. (please correct me if I am wrong)
I hope I am clear enough now !
Here are some links to get you started :
Create SSMS Addin
Extend Functionality in SQL Server 2005 Management Studio with Add-ins
Some Gotchas for SQL 2008 R2
SQL 2008 R2 Breaks SSMS Addins
I am working on Windows Forms Application with SQL Server Database. Now I have to convert the SQL Database to MS Access database as per the requirement. Can any one help me out
how to convert SQL database to MS access database so that, I can access the same tables.
Thanks & Regards,
Vani.
You can use MS SQL management studio to export tables data and structure to access. To do this right click on you db in Management studio and select Tasks -> Export data. Now follow the steps of the wizard. First you'll select the source - it would be you db, next destination - it would be an access file. And there you go :) Have fun!
As Elastep says, you can export data from MS SQL Management Studio - but that will only get you to .MDB-files; ie. prior to Access 2007. The steps below works both for 2007 and prior (although the actual path to execute them may vary in the different versions):
In Access you can import the tables from SQL Server - when in your target database in Access, choose External Data --> More --> ODBC Database. In there you can set up a connection to the SQL Server and choose between Import the source data and Link to the datasource. After selecting either, you can choose the tables you wish to import/link.
If you import, the data will be copied physically to the Access-file. It sounds like this is what you want to achieve.
However, as comments above suggest, this sounds off. Are you sure you want to move your data to a weaker engine? If you do want to keep the data in the SQL Server, whilst using Access only for forms, etc. you can link the tables instead. This way, you can use the rapid-prototyping, datacentric tools in Access, while keeping the security, consistency and scalability of the SQL Server.
For reference, you might want to take a look at this: http://office.microsoft.com/en-us/access-help/import-or-link-to-sql-server-data-HA010200494.aspx