Solved

.net Windows Form Application and SQL Server 2012 Express

Posted on 2014-02-01
2
463 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to shrink a transaction log file down to a reasonable size.

739 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