SqlConnection conn = new SqlConnection ( "server = it003; database = pubs; uid = sa; pwd ="); string sql = "select * from authors"; conn.Open (); SqlDataAdapter dta = new SqlDataAdapter (sql, conn) ; dta.Fill (Class1.ds, "authors"); dataGrid1.DataSource = Class1.ds.Tables [ "authors"]; DataGridTableStyle ts = new DataGridTableStyle (); ts.MappingName = Class1.ds.Tables [ "authors" ] .TableName; DataGridTextBoxColumn userNameCol = new DataGridTextBoxColumn (); UserNameCol.MappingName = Class1.ds.Tables [ "authors"] Columns [0] .ColumnName;. UserNameCol.HeaderText = "au_id"; ts.GridColumnStyles.Add (userNameCol) ; DataGridTextBoxColumn address = new DataGridTextBoxColumn (); address.MappingName = Class1.ds.Tables [ "authors"] Columns [ "address"] ColumnName;.. address.HeaderText = "address"; ts.GridColumnStyles.Add (address); Ts.GridColumnStyles [0] .width = 30; Ts.GridColumnStyles [1] .width = 30; DataGrid1.tables.Add (TS);