Using a database or table structure within program - c#

Basically all I want is to be able to create like a self contained database in my Windows Forms application, I do not want to connect to a server or anything like that with SQL Server, I just want like a small database in the application that can handle a few transactions.
Like for instance if I create a Windows Forms application then it would have its own small database in it and when deploying it.. it will save rows there and stuff. I remember hearing about a plug in, it started with a CT or something don't recall, but it would be a plugin for Visual Studio.
Any help would be much appreciated.
Regards

You can use SQL Server Compact or SQLite (ADO.NET provider is available here). Both are embedded database engines that run in-process. You don't need to install anything, just include the appropriate DLLs with your application.

Visual Studio has no problem providing you with just such a database. Just right click your project, add new item, and select SQL Server Database. The database created will be part of your project and can be deployed as needed.

If you have a limited amount of data you can just right-click the project and Add a DataSet. Then you can define multiple tables in the .xsd and store multiple rows. in the .xml. Then you can write some simple code in the .xsd code-behind to auto load and save defaults and even pull back rows of data. I typically use this approach for storing a single record in each table. It will also work with multiple records in each table. There's a point where if you start to get a lot of data you'll probably wish you had used something like SQL Compact Edition or something similar that you bundle with your app.

you can use sqlLite,this is the website
http://www.sqlite.org/
or you can use access too

Related

Sharepoint form writing to sql database

I want to build a form that will edit a table on SQL server. I known how to do it in ASP.NET (I need two drop down lists, gridview and button) but I want to make it as a part of SharePoint.
Can someone tell me what is the best technology to do that, I was looking at InfoPath but it seems I can not run it in web browser (only InfoPath filler). I just want to build simple form that is a part of Sharepoint and that is working in web browser. Please help.
Best regards
Daniel
One easy approach to read/write from/to SQL databases in SharePoint is to sync the external data with SharePoint lists. In this way you have the full feature set of lists available with best performance and highest security. Users are just working with a synchronized copy of the external data in the lists. To sync the data you can program by yourself, use PowerShell or 3rd party sync tools like the Layer2 Cloud Connector.
It is not a best practice in SharePoint to directly change the database.
One way you can do is Connecting to SQL Server Using the External Content Type Feature
http://www.dotnetcurry.com/sharepoint/794/sharepoint-2010-connect-sql-server-external-content-type
If you want to change directly , As you already know how to do it in Asp.net , you can go for Visual Webpart with same asp.net gridview and connection string

How to install SQL database with wpf application

I'm working with WPF application with local SQL database using Visual Studio.
I'm wondering about how can I install the database together with the application to make it work properly on another computer?
Sounds like you want to get your app working with SQLite, which is a database designed for a single application to store its data in.
There are many other types of embedded database, of course.
And if you need multiple people to use the database from separate applications, then you have to install the database separately, and you can't bundle the database with the application.

What is the best way to develop a C# project with a MySQL backend?

So I'm using C# 2010 Express and wondering what the best toolset is for developing a C# project with a MySQL backend? I know what if you use SQL Server Compact edition from within C# it will let you access the DB directly from the IDE. Is there a similar way to integrate the development with a remote MySQL Database?
Also, is MySQL a versatile enough solution for writing a program with C#? I am looking to build a seperate PHP web site (a reporting portal) that will access the MySQL data. I'd love to go open source all the way, but it seems like C# is the best app to create the app I'm trying to create (touch screen interface for data entry).
Whenever I program a database related homepage I always use HeidiSql and mysql. Both of them are easy to figure out and fast to use.
From their site:
HeidiSQL is a lightweight, Windows
based interface for MySQL databases.
It enables you to browse and edit
data, create and edit tables, views,
procedures, triggers and scheduled
events. Also, you can export structure
and data either to SQL file, clipboard
or to other servers.
All you do is install Mysql, set up a pass and username. and it's up and running.
Then all that's left is to install Heidisql. Heidisql it is a free program. If you need more details on how to attach heidi to your database please do write again.
There is
http://www.devart.com/dbforge/mysql/fusion/
But it's not free and is a plugin which you can't use with Express. There is no way to do this with Express as you can't add onto the basic functionality.

select a database and in that select tables. using c# . use web config

Im using c# .net windows form application.
I have many databases created using sql server Management studio 2005. Each database has several tables. i have a button, when clicked should allow me to select a database among several databases and in that database i want to select a single table. Later i need to display the contents of the selected table into a datagrid view.I came to know that it can be done using Webconfig. How can i acheive this?
It goes like this
a) select a database
b) In that database select a table
c) display the contents into a datagridview.
You got some things mixed up a bit. A web.config file is only used for web applications created with ASP.Net.
For windows application you can use the App.config file, which is like the web.config for web applications. As part of the app.config is the "connectionStrings" section which contains one or multiple connection string for database connections. Take a look at this page:
http://msdn.microsoft.com/en-us/library/ms254494%28VS.80%29.aspx
In code you then can retrieve the connections string via the ConfigurationManager.ConnectionStrings properties.
It is called "programming". Good enough an answer? I mean, you basically ask a LOT ;)
Ok, here some details:
You need to log into the server, obviously.
Then find out what databases exist. MASTER database is your friend - look at the sys schema there, you will find out the tables there contain all information.
Then you need to find out what tales exist. The INFORMATION_SCHEMA is your friend. It exists in every database. It has nice views that allow you to ask for tables, columns etc.
From there on it is some low level beginner training - given a database and table name, how do you get the data? ;)

Do my user need to install a database program to use my database program?

This might be a stupid question but I'm new at all this.
I want to create a Windows program that communicates with a database. Is there any way to do this without the user of my program have to install a database program like MySql?
I'm going to program it in C#.
You can use embedded databases like SQLite or Firebird Embedded.
You can find the full list of embedded database solutions on wikipedia page
SQL Server Compact works for you. But it doesn't support some functionalities. But you don't need to install a seperate database server. It works embedded.
Since you mention MySQL: MySQL Embedded Database
(It's not free, though.)

Categories