|
|
asp。net关于三层连接数据库 |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
在中间层访问数据库时,我想使用command方式从数据库读出数据放在datareader中,但是无法成功,请问各位有什么方法。(我不想用adapter方式)我的代码如下 [WebMethod] public System.Data.SqlClient.SqlDataReader getdata() { System.Data.SqlClient.SqlDataReader reader ;//= new System.Data.SqlClient.SqlDataReader(); sqlConnection.Open(); sqlCommand.CommandText = "select top 1 * from authors"; reader = sqlCommand.ExecuteReader(); reader1 = reader["id"].ToString(); return reader; }
|
|
相关文章:相关软件: |
|