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(
	string Sql,
	IDictionary Params
)
Visual Basic (Declaration)
Public Function ExecuteSingletonQuery ( _
	Sql As String, _
	Params As IDictionary _
) As Boolean
Visual C++
public:
bool ExecuteSingletonQuery(
	String^ Sql, 
	IDictionary^ Params
)

Parameters

Sql
Type: System..::.String

The SQL statement

Params
Type: System.Collections..::.IDictionary

Parameter values collection

Return Value

Returns True if a record is found otherwise False

Examples

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

See Also