ASP. Net About Layer 3 Connection Database

xiaoxiao2021-03-06  68

When accessing the database in the middle layer, I want to read the data from the database in DataReader using the Command mode, but I can't succeed, do you have any way you have. (I don't want to use Adapter mode) My code is as follows.

[WebMethod]

Public system.data.sqlclient.sqldatarader 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;

}

转载请注明原文地址:https://www.9cbs.com/read-92151.html

New Post(0)