Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

really confused

$
0
0

I am an old ADO.net programmer and am now porting over my legacy code to entity.

I have been stuck now for about a day trying to understand something and not finding much help online so here I am

I am using the using construct to open my entity connection, something like (in VB)

Using context As New IT_MasterDBContext(...connection info here ...)

     sql = "select * from table where ID = 10" ' let's say, for example there are 100 rows in this table and 10 have ID = 10

     context.table.sqlquery(sql).ToList

END USING

I don't get any errors, however the where clause seems to be ignored.  No matter what sql query I write (oddly enough I can even write sql="*" as the sql string) and I still get 100 rows

sql = "select * from table" >> returns 100 rows

sql = "select top 5 * from table" >> returns 100 rows

even

sql = "*" >> returns 100 rows

Obvioulsy I am making a mess of the use of SqlQuery and or the .ToList attribute of the DBset, can someone enlightened and old and confused programmer?

Thanks in advance and Merry Christmas


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>