Solved

.net Windows Form Application and SQL Server 2012 Express

Posted on 2014-02-01
2
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Surendra Nath earned 500 total points
ID: 39827235
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
ID: 39827261
You can do it all thru code.  Here's a snapshot of my Database Utilities window.
ScreenCapture.jpg
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

626 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