Conversion Of SQL Database to MS Access Database - c#

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

Related

Connecting to SQL Server database with RevitAPI

I'm trying to export Revit data to an external database. What I'm looking for is to use RevitAPI to do the job of exporting. Though if there is a way to do so using Revit's own tools it'll be fine. As long as I can choose and modify the columns in exported tables.
Does anybody have any suggestions?
I've already tried "Revit > Export > ODBC", but this option only exports some default parameters and I can not modify the columns I want in my tables.
I'm also aware of Revit DB Link. It is for subscribed users only so that's not an option here.
You can implement an Revit add-in to access the data you require from the Revit database and manipulate that into the form you require for export. For the actual connection to the external SQL database, you will have to use some additional library. For that, I would suggest searching the Internet for something like sql server .net api.

Using a local database

I'm busy writing a small app and I only want a database to load small amounts of data, in other words I don't need the functionality of SQL.
So I've installed filehelpers, but it seems very limited in the sense that I can read/write and even append data, but it seem impossible to delete one row of data in a table?
Does anyone know how to do this with filehelpers or point me to a different solution where I can just add a local db to my app without any other external software required?
PS. My visual studio does not have the "create local db" from the item selection.
For something like this, I'd use an embedded SQLite database. It gives you the best of both worlds, one file database for local data and most of the features of SQL.
See here: https://sqlite.org/
On their download page, they have lots of stuff and a plugin for VS:
https://sqlite.org/download.html

SQL table getting deleted by itself in local db, using LINQ to SQL [duplicate]

I'm making a WinForms app in C#. When I go to create my database object, I'm presented with two options:
Local Database
Service-based Database
All I want is a simple local database to use for my project.
However, if I select "Local Database (Compact Edition)" then after I create my tables and drag them over to a LINQ-To-SQL Class creator it says:
The selected object(s) use an unsupported data provider.
So, I don't know why creating a local database would be considered an unsupported provider when dragging to tables to the Object Relational designer.
So, I try the second type, "Service-based Database". I lay out my tables how I want for my basic application and make my tables. The LINQ-To-SQL Designer works fine when I drag these tables and I proceed to write my code in my app to insert and upate the database entries.
However, with this second "Service-based Database" my inserts and updates work as long as the application is running. However, once I close it it reverts back to what it was before. If I manually add in data via the Server Explorer it persists but any inserts I do don't save.
Why can't I create and use a Local Database with LINQ?
If that isn't an option, then why isn't the "Service-Based Database" (whatever that is), persisting beyond the application closing?
Thanks for your time!
Edit: Apparently the LINQ-To-SQL Object Designer doesn't work on Compact Edition Local Databases. It can still be done, but you have to use SqlMetal apparently to generate the dmbl file.
When you compile, the old database gets erased and a new one is copied to the bin folder. Therefore try link (using linq) to the database in the bin folder. Try change your connectionString.

How to get data from SQL Server from one environment to another environment?

I have a environment called (Local) and other (Back-up).
From back-up database I have some stored procedures as well as tables which are populated.
In my local I have those stored procedures and table but nothing is stored in them.
So I want to get data from my back-up environment to my local DB environment, how may I achieve this?
I am using SQL Server
There are a few good options listed in other answers. But depending on how often you need to do this activity or how granular control you need, Red Gate's SQL Data Compare let's you compare databases and determine what data should be moved, which direction. Very powerful and easy to use. It's not cheap: starts at $400US but there is a 14 day trial available.
I have no affiliation to them, I'm just a very satisfied customer.
If you want to get only the data in the database, one way to do it in MS SQL Server Management Studio is to export the data from one source to another.
Right-Click on the source database, select "tasks", then select "export data" and follow the instructions of the wizard. It is possible you need to modify some settings such as "identity insert".
To handle the structure of the database, you can generate scripts, namely,
Right-Click on the source database, select "tasks", then select "generate scriptis"
In the end, you can always do a backup / restore of your "back up" db over your local db.
Right-click on the source database, select "tasks", then select "back up..." and follow the instructions of the wizard. In this case, you will want to back up to a file
Afterward, you can restore it using a similar way.
Right-click on the dest database, select "tasks", then select restore. In this case, you will want to select to restore from file.
I hope this helps.
I would recommend using SSIS ("Import Data" from Management Studio) to copy the table data. (in SQL Management Studio, right-click your DB and choose Tasks->Import)
The Stored Procedures are better (IMO) being imported via a SQL Script (in SQL Management Studio, right click the DB and choose Tasks, "Generate Scripts". Note: getting your SPs via SQL will not import any permissions by default.
I would sugest creating SSIS(ETL) package. It's very powerful tool and not Ad-hoc solution like Redgate SQL Data Compare or backup/restore.
In larger enviroinment I would recommend Replication, but it's much bigger topic.
to export data from one DB to another if they have same schemas is very easy. u just have use the impot export wizard inbuild in ssms and specify the source and destination DB's and the select the list of tables to be copied
watch this video
www.youtube.com%2Fwatch%3Fv%3DeDfhTPU7P-M&ei=DUhwULvhM4LPrQeY9oDoCA&usg=AFQjCNGA5a1o-yL9z-31EQQAQed-r5Pvlg&sig2=SiSTQ9tDackePFXw9-5vmw

LINQ Confusion - Database not persisting after the application closes?

I'm making a WinForms app in C#. When I go to create my database object, I'm presented with two options:
Local Database
Service-based Database
All I want is a simple local database to use for my project.
However, if I select "Local Database (Compact Edition)" then after I create my tables and drag them over to a LINQ-To-SQL Class creator it says:
The selected object(s) use an unsupported data provider.
So, I don't know why creating a local database would be considered an unsupported provider when dragging to tables to the Object Relational designer.
So, I try the second type, "Service-based Database". I lay out my tables how I want for my basic application and make my tables. The LINQ-To-SQL Designer works fine when I drag these tables and I proceed to write my code in my app to insert and upate the database entries.
However, with this second "Service-based Database" my inserts and updates work as long as the application is running. However, once I close it it reverts back to what it was before. If I manually add in data via the Server Explorer it persists but any inserts I do don't save.
Why can't I create and use a Local Database with LINQ?
If that isn't an option, then why isn't the "Service-Based Database" (whatever that is), persisting beyond the application closing?
Thanks for your time!
Edit: Apparently the LINQ-To-SQL Object Designer doesn't work on Compact Edition Local Databases. It can still be done, but you have to use SqlMetal apparently to generate the dmbl file.
When you compile, the old database gets erased and a new one is copied to the bin folder. Therefore try link (using linq) to the database in the bin folder. Try change your connectionString.

Categories

Resources