将 CommandText 发送至 Connection 并构建 DB2Record。此方法适用于包含单行的结果集。
[Visual Basic]
Public Function ExecuteRow () As DB2Record
[C#]
public DB2Record ExecuteRow()
[C++]
public:
DB2Record ExecuteRow ()
[JScript]
public function ExecuteRow () : DB2Record
DB2Record 实例,表示结果集的第一行(或仅第一行)。
[C#] 以下示例演示如何创建 DB2Record 并从中读取列数据。
[C#]
public static string getSalesData(DB2Connection conn)
{
string salesQuery = "SELECT MAX(SALES) FROM SALES";
string salesData = "";
DB2Command cmd = new DB2Command(salesQuery, conn);
DB2Record salesRec = cmd.ExecuteRow();
salesData = salesRec.GetDB2Int32(0).ToString();
return salesData;
}