Executes a select statement or stored procedure and reads the first row of the returned record set

Namespace:  DbNetLink.Data
Assembly:  DbNetLink.DbNetData (in DbNetLink.DbNetData.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public bool ExecuteSingletonQuery(
	CommandConfig CmdConfig
)
Visual Basic (Declaration)
Public Function ExecuteSingletonQuery ( _
	CmdConfig As CommandConfig _
) As Boolean
Visual C++
public:
bool ExecuteSingletonQuery(
	CommandConfig^ CmdConfig
)

Parameters

CmdConfig
Type: DbNetLink.Data..::.CommandConfig

The SQL statement and parameter values

Return Value

Returns True if a record is found otherwise False

Examples

CopyC#
DbNetData Db = new DbNetData( ConfigurationManager.ConnectionStrings["nwind"] );
Db.Open();
CommandConfig CmdConfig = new CommandConfig("select productname from products");
CmdConfig.Params["id"] = ProductID.Value;
if ( Db.ExecuteSingletonQuery(CmdConfig) )
    ProductName.Text = Db.ReaderValue("productname"); 
Db.Close();

See Also