DbDataAdapter Select Method (String,  Object )NReco.Data Class Library Documentation

Namespace: NReco.Data
Assembly: NReco.Data (in NReco.Data.dll) Version: 1.0.2
Syntax

public DbDataAdapter SelectQuery Select(
	string sql,
	params Object[] parameters
)

Parameters

sql
Type: System String
The raw SQL query.
parameters
Type:  System Object 
The values to be assigned to parameters.

Return Value

Type: DbDataAdapter SelectQuery
prepared select query
Remarks

Semantics of this method is similar to EF Core DbSet.FromSql. Any parameter values you supply will automatically be converted to a DbParameter:
dbAdapter.Select("SELECT * FROM [dbo].[SearchBlogs]({0})", userSuppliedSearchTerm).ToRecordSet()
.

You can also construct a DbParameter and supply it to as a parameter value. This allows you to use named parameters in the SQL query string -

dbAdapter.Select("SELECT * FROM [dbo].[SearchBlogs]({@searchTerm})", new SqlParameter("@searchTerm", userSuppliedSearchTerm)).ToRecordSet()

See Also