select count(name) as 变量名 from booklist where name='tom'
 
textbox1.text=rs["变量名"].Tostring();

解决方案 »

  1.   

    楼上你好!能给我比较详细的解释吗?我的疑问是:你的rs是如何定义的?数据库连接好后,写出sql语句:Dim strSelect As StringstrSelect="select count(name) as xyz from booklist where name='tom'那么然后呢?再如何去执行这个sql语句?我刚学.net还请楼上多多指教!
      

  2.   

    you try
    use DataAdapater("strSelect",ConnectionString);
      

  3.   

    select count(name) as tt from booklist where name='tom'
    在存贮过程中可以用out参数返回.
    也可以用datareader 返回.
    while rs.reader
      字符串变量=rs("tt").tostring
    end
      

  4.   

    myCommand.CommandText = "SELECT COUNT(*) AS iCount FROM table_name"; 
    int iCount = (int)myCommand.ExecuteScalar();