How to create SQL Database Schema for Microsoft membership provider?

by Evgelen 22. March 2010 06:18

In order to create SQL Database Schema for Microsoft membership provider you need to Open Visual Studio Command Prompt and type aspnet_regsql command (as you can see below)

 

Tags: , ,

ASP.NET | SQL | SQL 2005 | SQL 2008

How to see SQL instances installed on the server?

by Evgelen 21. January 2010 20:22

  1. Click "Start" and "Run" or Windows Key + R
  2. Type cmd
  3. Then Go to the root folder of C:\ drive
  4. Type osql -L
  5. The system return the names of all instances installed on your server

Tags: , , ,

SQL | Windows XP | Windows 7

SQL Query how to select entry by char count?

by Evgelen 12. December 2009 21:55
SELECT * FROM TableName WHERE len(ColumnName) > 100

Tags: , , , ,

SQL

ASP.NET C# Bind DropDownList Control from SQL Datasource

by Evgelen 4. December 2009 20:03

ASP.NET C# Bind DropDownList Control from SQL Datasource

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

private void Page_Load(object sender, EventArgs e)
        {
            DropDownListBind();
        }

        public void DropDownListBind()
        {
            var conn = new SqlConnection
              {
                 ConnectionString =
                                   ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()
              };

            var cmd = new SqlCommand("SELECT * FROM TableName", conn);
            cmd.Connection.Open();

            var dropDownListsValues = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            DropDownListControl.DataSource = dropDownListsValues;
            DropDownListControl.DataValueField = "ControlId";
            DropDownListControl.DataTextField = "ControlData";
            DropDownListControl.DataBind();

            cmd.Connection.Close();
            cmd.Connection.Dispose();
        }


private void Page_Load(object sender, EventArgs e)
        {
            DropDownListBind();
        }

        public void DropDownListBind()
        {
            var connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
            using (var conn = new SqlConnection(connectionString))
            {
                var cmd = new SqlCommand("SELECT * FROM TableName", conn);
                cmd.Connection.Open();
                var dropDownListsValues = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                DropDownListControl.DataSource = dropDownListsValues;
                DropDownListControl.DataValueField = "ControlId";
                DropDownListControl.DataTextField = "ControlData";
                DropDownListControl.DataBind();
            }
        }

Tags: , , ,

ASP.NET | C# | SQL

How to attach the SQL Database and Log file using SQL Query?

by Evgelen 13. November 2009 22:40

sp_attach_db @dbName = 'DataBase',
@filename1 = 'C:\folder\Database.mdf', 
@filename2 ='C:\folder\Database_log.ldf'

Tags: , , , , ,

SQL

Tag cloud