1。c#将字符型转换成整型的的函数是什么?
2。c#中怎样使用dataset对象查询数据库,我看许多书上都是dataset作为datagrid的数据源使用,能不能将其绑定到像textbox这样的控件上?怎样进行,请给出具体步骤,谢了!

解决方案 »

  1.   

    2、你有问的时间,看年msdn的帮助,什么都会了
      

  2.   

    Convert.ToInt64(str);
    或int.Parse(str);
      

  3.   

    第一个问题大家都说了,第二个问题解法如下:using System.Data;
    using System.SqlClient;
    ....
    //查询数据,使用SQL SERVER自带的NorthWind数据库
    SqlConnection conn = new SqlConnection("user id=sa;data source=localhost;persist security info=true;initial catalog=Northwind;password=sa");
    DataSet ds = new DataSet();
    string sql = "select top 10 CustomerID, CompanyName from Customers";
    SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
    adapter.Fill(ds);
    DataTable myTable = ds.Tables[0];//让text控件的显示结果集中的CompanyName字段
    textBox1.DataBindings.Add("Text", myTable, "CompanyName");
    CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[myTable];
    myCurrencyManager.Position = 0;//设置myCurrencyManager.Position即可使text显示数据集中的第几条记录值
      

  4.   

    lldwolf  真有耐心向你学习
      

  5.   

    DataGrid,DataList属于多值绑定,接受的数据源只要实现了 IEnumerable 接口都行,常用的就是 DataSet,DataTable,DataView,还有数组,集合基本上所有的Web Control的属性值都可以实现单值的绑定,包括样式属性 如 width,color
    常见的如:myTextBox.Text = myDataTable.Rows[rowindex][columnindex];很多这种问题MSDN里面都有参考例子的,建议楼主多查阅MSDN