0

I am new to EF. Trying to fetch some record for a inline query ..

i have followed http://geekswithblogs.net/rgupta/archive/2010/06/23/entity-framework-v4-ndash-tips-and-tricks.aspx

Have dode

var lstStatInfo = new List<BISRCNCCYC>();
                using (var contextobj = new TADBEntities(_connStr, _scheName))
                {

                    string sql = "select * from MYTABLE where MYID = :MYID";
                    int id = 475;
                    var args = new DbParameter[] { new OracleParameter { ParameterName = "MYID", Value = "475" } };
                    var students = contextobj.Database.ExecuteSqlCommand(sql, id);
                    return lstStatInfo;
                }

Have even tried How to pass parameters to the DbContext.Database.ExecuteSqlCommand method?

but getting error ORA-00936: missing expression

I am trying to connect oracle not SQl ...what should be the correct way ?

Community
  • 1
  • 1
Rahul Chowdhury
  • 1,138
  • 6
  • 29
  • 52

1 Answers1

0

change your

string sql = "select * from MYTABLE where MYID = {0}";

To

string sql = "select * from MYTABLE where MYID = :MYID";
Nagaraj S
  • 13,316
  • 6
  • 32
  • 53