修改一下查询语句就可以了。例如:
SqlConnection strConn=new SqlConnection("server=.;uid=sa;database=student");
strConn.open();
SqlDataAdapter da=new SqlDAtaAdapter("select 姓名,年龄,性别 from Into ",strConn);
DataSet ds=new DataSet();
da.fill(ds);
DataGrid1.DataSource=ds.tables[0].defaultview;
dataGrid1.databind();
**你只要修改一下上面的select 语句就以了。祝你好运。

解决方案 »

  1.   

    You can use your DataSet's ColumnMapping property to hide a column. 
     
         // Creating connection and command sting 
     
         string conStr = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb"; 
     
         string sqlStr = "SELECT * FROM Employees"; 
     
         // Create connection object 
     
         OleDbConnection conn = new OleDbConnection(conStr); 
     
         // Create data adapter object 
     
         OleDbDataAdapter da = new OleDbDataAdapter(sqlStr,conn); 
      
         // Create a dataset object and fill with data using data adapter's Fill method 
     
         DataSet ds = new DataSet(); 
     
         da.Fill(ds, "Employees"); 
      
         // Hide the column and attach dataset's DefaultView to the datagrid control 
     
         ds.Tables["Employees"].Columns["LastName"].ColumnMapping = MappingType.Hidden; 
     
         dataGrid1.DataSource = ds.Tables["Employees"]; 
      

  2.   

    呵呵,报歉,我上面的有一点错,最后一句不要。我又当成是做B/S模式下的绑定了。去掉这句:DataGrid1.DataBind();
      

  3.   

    可以重新构造一个新的数据集生成大dataview对象