Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get result table using SQL stored procedures with parameter values in NReco.Data.DbDataAdapter .Net core

What I have tried:

C#
var dbFactory = new DbFactory(SqlClientFactory.Instance)
            {
                LastInsertIdSelectText = "SELECT @@IDENTITY"
            };
var dbCmdBuilder = new NReco.Data.DbCommandBuilder(dbFactory);
var dbConnection = dbFactory.CreateConnection();
dbConnection.ConnectionString = "Data Source....";
var dbAdapter = new NReco.Data.DbDataAdapter(dbConnection, dbCmdBuilder);

//Here I want to call SQL stored procedure
//With parameters
var shopDetails = dbAdapter.Select(new Query("usp_GetShops")).ToRecordSet();
Posted
Updated 9-May-17 23:31pm
v2
Comments
CHill60 26-Apr-17 9:42am    
I am going to delete my solution as it appears to be inappropriate. I suggest you contact NReco: contact us[^].
Andy Lanng 26-Apr-17 11:01am    
Just read up. news to me. 5* on you comment

1 solution

DbDataAdapter class has Select(string sql, params Object[] parameters) method overload that works exactly like "FromSql" in EF Core:
dbAdapter.Select("execute STOREDNAME {0}", paramValue).ToRecordSet()

Also you can compose SqlParameter by yourself and use it as argument too.
 
Share this answer
 
Comments
Einstein Ravi 12-Jul-18 9:26am    
Can you please share code snippet for dbAdapter.Delete("Oracle-SQL Native Query", "OracleParameters[]");...? Thanks..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900