Solved

.net Windows Form Application and SQL Server 2012 Express

Posted on 2014-02-01
2
452 Views
Last Modified: 2014-02-02
I have a C# .net windows form application that uses SQL Server 2012 Express. Is there an easy way to provide SQL Server database management through an application?  For example, I want to provide my users the ability to create tables, change tables and delete tables.  Is there a .net class or a plugin component that can be used to provide a UI window for users to do these type of things?
0
Comment
Question by:hojohappy
2 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 500 total points
Comment Utility
What you are looking for is a kind of SSMS (SQL Server Management Studio), but a concise version of it...

You can do it, in .NET, but not without huge coding stuff....

The below code can be used to create a table

function void abcd(string SQL)
{
using (SqlConnection con = new SqlConnection(conStr))
        {
            try
            {
                //
                // Open the SqlConnection.
                //
                con.Open();
                //
                // The following code uses an SqlCommand based on the SqlConnection.
                //
                using (SqlCommand command = new SqlCommand(SQL, con))
                    command.ExecuteNonQuery();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
}

Open in new window


you can use this function to create the table as below

abcd("CREATE TABLE Customer(First_Name char(50),Last_Name char(50),Address char(50),City char(50),Country char(25),Birth_Date datetime);");

Open in new window



but this does not provide a good UI as it has in the SSMS.
0
 
LVL 12

Expert Comment

by:ktaczala
Comment Utility
You can do it all thru code.  Here's a snapshot of my Database Utilities window.
ScreenCapture.jpg
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now