Solved

.net Windows Form Application and SQL Server 2012 Express

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

910 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

21 Experts available now in Live!

Get 1:1 Help Now