none
Connect sql server through gui. RRS feed

All replies

  • Use System.Data.SqlClient
    Friday, December 1, 2017 9:17 AM
  • You can use any DAL (Data Access Layer) or you can write your own code in .cs file of <g class="gr_ gr_69 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling" data-gr-id="69" id="69"><g class="gr_ gr_76 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="76" id="76">aspx</g></g> page to connect to SQL server.

    Create connection

    using(SqlConnection conn = new SqlConnection()) {   conn.ConnectionString = "Server=[server_name];Database=[database_name];Trusted_Connection=true"; // using the code here...

    conn.Open();

    SqlCommand command = new SqlCommand("SELECT * FROM TableName", conn);

    // Create new SqlDataReader object and read data from the command.
    using (SqlDataReader reader = command.ExecuteReader())
    {
        // while there is another record present
        while (reader.Read())
        {
            // write the data on to the screen
            Console.WriteLine(String.Format("{0} \t | {1} \t | {2} \t | {3}",
            // call the objects from their index
            reader[0], reader[1], reader[2], reader[3]));
        }
    }

    }


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful". CRMHUNT http://crmhunt.com

    Friday, December 1, 2017 9:23 AM
  • Hi Rudi,

    Please explain the overall process in details. I am new in .net technology.

    Thanks

    Friday, December 1, 2017 10:16 AM
  • Hi,

    I have to connect sql server database through graphical user interface in web application.

    So, how i can do that. 

    Friday, December 1, 2017 10:21 AM
  • Hello,

    You might also consider using Entity Framework. The following is for Visual Studio 2017 and ASP.NET.

    Each bullet has step by step guidance.

    https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Proposed as answer by Cor Ligthert Friday, December 1, 2017 12:43 PM
    Friday, December 1, 2017 10:28 AM
  • You can use any DAL (Data Access Layer) or you can write your own code in .cs file of <g class="gr_ gr_69 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling" data-gr-id="69" id="69"><g class="gr_ gr_76 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="76" id="76">aspx</g></g> page to connect to SQL server.

    Create connection

    using(SqlConnection conn = new SqlConnection()) {   conn.ConnectionString = "Server=[server_name];Database=[database_name];Trusted_Connection=true"; // using the code here...

    conn.Open();

    SqlCommand command = new SqlCommand("SELECT * FROM TableName", conn);

    // Create new SqlDataReader object and read data from the command.
    using (SqlDataReader reader = command.ExecuteReader())
    {
        // while there is another record present
        while (reader.Read())
        {
            // write the data on to the screen
            Console.WriteLine(String.Format("{0} \t | {1} \t | {2} \t | {3}",
            // call the objects from their index
            reader[0], reader[1], reader[2], reader[3]));
        }
    }

    }

    Please explain the overall process in details. I am new in .net technology.

    Thanks


    Friday, December 1, 2017 11:31 AM
  • Use System.Data.SqlClient
    Please, explain the process in details.
    Friday, December 1, 2017 11:50 AM
  • I want to connect sql server database  through web form. How can i do it.

    Where you should post is to the Web Form forum in ASP.NET forums.

    https://forums.asp.net/

    Friday, December 1, 2017 12:40 PM