Executes a select statement or stored procedure and reads the first row of the returned record set
| C# | Visual Basic |
public bool ExecuteSingletonQuery( CommandConfig CmdConfig )
Public Function ExecuteSingletonQuery ( _ CmdConfig As CommandConfig _ ) As Boolean
- CmdConfig (CommandConfig)
-
The SQL statement and parameter values
Returns True if a record is found otherwise False
DbNetData Data = new DbNetData( ConfigurationSettings.AppSettings[ "nwind" ] ); Data.Open(); CommandConfig CmdConfig = new CommandConfig("select productname from products"); CmdConfig.Params["id"] = ProductID.Value; if ( Data.ExecuteSingletonQuery(CmdConfig) ) ProductName.Text = Data.ReaderValue("productname"); Data.Close();