Namespace: NReco.DataAssembly: NReco.Data (in NReco.Data.dll) Version: 1.0.2
public DbDataAdapter SelectQuery Select(
string sql,
params Object[] parameters
)
public DbDataAdapter..::..SelectQuery Select(
string sql,
params Object[] parameters
)
Public Function Select (
sql As String,
ParamArray parameters As Object()
) As DbDataAdapter SelectQuery
Public Function Select (
sql As String,
ParamArray parameters As Object()
) As DbDataAdapter..::..SelectQuery
public:
DbDataAdapter SelectQuery^ Select(
String^ sql,
... array<Object^>^ parameters
)
public:
DbDataAdapter..::..SelectQuery^ Select(
String^ sql,
... array<Object^>^ parameters
)
member Select :
sql : string *
parameters : Object[] -> DbDataAdapter SelectQuery
member Select :
sql : string *
parameters : Object[] -> DbDataAdapter..::..SelectQuery
Return Value
Type:
DbDataAdapter SelectQueryprepared select query
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()
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()
dbAdapter.Select("SELECT * FROM [dbo].[SearchBlogs]({@searchTerm})", new SqlParameter("@searchTerm", userSuppliedSearchTerm)).ToRecordSet()