你用什么访问SQL SERVER?ADO还是ADO.NET?

解决方案 »

  1.   

    1.DataSet.Tables[0].Columns.Count,DataSet.Tables[0].Columns[0].ColumnName
    2.DataSet.Tables[0].Rows
    3.DataSet.Tables[0].Rows[0][0]
      

  2.   

    楼上的回答的很详细,使用的.net
      

  3.   

    怎么知道当前记录的位置?为什么用  .Rows  来求?
    好像求不出来。
      

  4.   

    楼上 asam2183(三山) 已经说得比较清楚了至于当前位置可用
    BindingManagerBase.Position访问
      

  5.   

    我只能显示第一条记录的每项信息,请问怎么显示当前记录的信息?i =theDataSet.Tables[tableName].Columns.Count;
    for (j=0;j<=i-1;j++ )
    {
    MessageBox.Show ( theDataSet.Tables[tableName].Columns[j].ColumnName);
    MessageBox.Show ( theDataSet.Tables[tableName].Rows[0][j].ToString ());
    }
      

  6.   

    来晚了,
    94
    1.DataSet.Tables[0].Columns.Count,DataSet.Tables[0].Columns[0].ColumnName
    2.DataSet.Tables[0].Rows
    3.DataSet.Tables[0].Rows[0][0]
      

  7.   

    theDataSet.Tables[tableName].Rows[index]
    可以得到指定行的数据DataGrid.CurrentRowIndex 属性 可以得到当前行的行号而一般,dataset 总是和 datagrid 绑定的,可以两者结合,达到你的目的
      

  8.   

    这是另外一种方式,可以查找特定的行private void FindInMultiPKey(DataTable myTable){
        DataRow foundRow;
        // Create an array for the key values to find.
        object[]findTheseVals = new object[3];
        // Set the values of the keys to find.
        findTheseVals[0] = "John";
        findTheseVals[1] = "Smith";
        findTheseVals[2] = "5 Main St.";
        foundRow = myTable.Rows.Find(findTheseVals);
        // Display column 1 of the found row.
        if(foundRow != null)
          Console.WriteLine(foundRow[1]);
     }
      

  9.   

    lemong(風之影) ,你好:为什么在我的dbgrid中点击别的行时,index还是不变?以下是代码:
    private void dataGrid1_Click(object sender, System.EventArgs e)
    {
    MessageBox.Show ( common.dbindex.ToString() );
    }