<script>
var tr=document.all("your_data_grid_id").children(0).children(0);
alert(tr.children(0).innerText);
</script>

解决方案 »

  1.   

    WinForm:private int position_x;
    private int position_y;private void Form_Load(object sender,EventArgs e)
    {DataSet ds=new DataSet();
    ...
    dataGrid1.DataSource=ds.Tables[0];
    DataGridCell c=new DataGridCell(0,0);
    Rectangle rc=this.dataGrid1.GetCellBounds(c);
    position_x=rc.Left;
    position_y=rc.Top;
    }
    //下面的方法取得第一行某一列的值
    private string GetValueAtFirstRow(int ColumnIndex)
    {
    DataGrid.HitTestInfo hti=dataGrid1.HitTest(position_x,position_y);
    return dataGrid1[hti.Row,ColumnIndex].ToString());
    }
    当然,如果你重新设置了RowHeaderWidth或者会影响第一行在DataGrid位置的其他属性,你必须重新设置position_x和position_y
      

  2.   

    string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=tian.mdb"; 
    OleDbConnection myConn = new OleDbConnection(strDSN);
    OleDbDataAdapter myCommand = new  OleDbDataAdapter("SELECT * FROM ce", myConn); 
    DataSet ds = new DataSet(); 
    myCommand.Fill(ds, "ce");
    DataRow dr = ds.Tables["ce"].Rows[0]; 


    STRING STR=dr["xi"].TOSTRING;
    其中xi时列字段名