Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

.net Windows Form Application and SQL Server 2012 Express

Posted on 2014-02-01
2
Medium Priority
?
467 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 2000 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 13

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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 the fundamental information of how to create a table.

721 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