You should use a
SqlConnection and set its
ConnectionString
property to connect to SQL Server DB. Then you should create a
SqlCommand object and set its
Connection
property with your SqlConnection and
CommandText
property to a Sql command(e.g. Select * from MyTable). There are many ways to fetch data from SqlCommand, but the simplest way is using
SqlDataReader. In this way you should use
ExecuteReader() method of SqlCommand to load fetched data from database into your SqlDataReader. It's done. Now you should assign SqlDataReader to your DataGrid control's
DataSource
property and call
DataBind()
method.