Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

desanti

@desanti
About
Posts
158
Topics
53
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Count the number of database hit were made
    D desanti

    i'm trying a 3d party tools Query Future | Entity Framework Plus[^] But i'm not sure if it's true what this tool claim to do ? The sql profiler it says : exec sp_executesql N'---EF+ Query Future 1 of 5....... .After there are 5 queries (I have 5 query that are executed with Future) But i don't know if these queries are executed in a single database hit ?

    Visual Basic question database

  • Count the number of database hit were made
    D desanti

    Are you Gerry Schmitz ?

    Visual Basic question database

  • Count the number of database hit were made
    D desanti

    I want to know if this software is telling the truth or no , if yes I want to use it.

    Visual Basic question database

  • Count the number of database hit were made
    D desanti

    Hello ! I'm using entity framework Is there any way to count how many database hit were made ? ( The reason why I make this question, is because i'm using a 3d party software that add some commands to Entity Framework. One of these is that several different queries (the software claim) are executed using a single database hit. I want to verify this.) Thank you !

    Visual Basic question database

  • Are these queries doing the same thing
    D desanti

    Hello ! I'm using Entity Framework 6 with sql server 2008r2 database. I want to get from database only those records that have vl1>5.( i need to get from database only those objects that have vl1>5 and not to read all the objects and after to apply the condition ) I have 2 queries :

    Dim query1 as IeQueryable(of myobj)= (From t in context.myobjs Where vl1<5).Tolist

    Dim query2= (From t in context.myobjs.Asqueryable Where vl1<5).Tolist

    Are these queries doing the same job that i want ?

    Visual Basic database sql-server sysadmin question career

  • How to clear a bindingsource without deleting from database
    D desanti

    ok , but Bindingsource.clear only remove items from bindingsource or also mark them for deletion from database ?

    Visual Basic csharp database tutorial

  • How to clear a bindingsource without deleting from database
    D desanti

    I've tried also Bindingsource.Clear

    Bindingsource.Clear

    Bindingsource.Clear , this is working , but does this remove also from database ( if I call savechanges for example ?)

    Visual Basic csharp database tutorial

  • How to clear a bindingsource without deleting from database
    D desanti

    Hello ! I'm using vb.net 2017 and EF 6. I have a bindingsource and also datagrid that is bound to this bindingsource. I need a way to clear all the items from bindingsource to empty it , but without deleting from database. I've tried

    Bindingsource1.Datasource=Nothing.

    But , after calling this , the datagrid still have all the bindingsource items.

    Visual Basic csharp database tutorial

  • Visual Basic : Entity Framework update only one table in model from database
    D desanti

    Hello ! I'm using vb.net 2017 and Entity Framework 6. Is there any way to update only one table in model from database ? I try to right click on model.edmx and choose Update model from database , but this way update and recreate the entire model. I've tried also to delete only the table that I've changed on database , and after I choose Update model from database and after on ADD I select only this table , but after the entire model is recreated. How can I do ?

    Visual Basic question csharp database announcement

  • Entity Framework Select several levels of childs
    D desanti

    I mean better for performance and the complexity of sql query that is generated in each case..

    Visual Basic database help question

  • Entity Framework Select several levels of childs
    D desanti

    I've found 2 solutions that are working. Can someone tell me which is better ? Solution 1

    Dim lst = (From t In context.MasterTable.Where(Function(t1) t1.id = 7)
    Select New With {
    t,
    .chld1 = t.child1s.Where(Function(t21) t21.vl1 >5),
    .chld2 = t.child2s.Where(Function(t31) t31.vl2>6 ),
    .chld3 = t.child3s.Where(Function(t41) t41.vl3>7),
    .chld3itms = t.child3s.Where(Function(t51) t51.vl3>7).Select(Function(t511) t511.Child3Itms)
    }).ToList

    Solution 2

    Dim lst = (From t In context.MasterTable.Where(Function(t1) t1.id = 7)
    Select New With {
    t,
    .chld1 = t.child1s.Where(Function(t21) t21.vl1 >5),
    .chld2 = t.child2s.Where(Function(t31) t31.vl2>6 ),
    .chld3 = (From t2 in t.child3s.Where(Function(t41) t41.vl3>7)
    Select New With {
    t2,
    .chld3it=t2.Child3Itms
    })
    }).ToList

    Visual Basic database help question

  • Entity Framework Select several levels of childs
    D desanti

    Now i'm getting an error :

    System.NotSupportedException: 'LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[Myprog.Child3] Include[child3,ICollection`1](System.Linq.IQueryable`1[Myprog.Child3], System.Linq.Expressions.Expression`1[System.Func`2[Myprog.Child3,System.Collections.Generic.ICollection`1[Myprog.Child3itm]]])' method, and this method cannot be translated into a store expression.'

    Visual Basic database help question

  • Entity Framework Select several levels of childs
    D desanti

    I'm using entity Framework 6. On my database I have these tables :

    MasterTable ( Id , name)
    Child1 ( ID , name , vl1 , Master_ID)
    Child2 ( ID , name , vl2 , MasterID )
    Child3 (ID , name , vl3 , Master_ID )
    Child3Itm ( ID , name , Child3_ID)

    For a given `MasterTable` item, I want to load with a single Query from database:

    • All `Child1` where `vl1 > 5`
    • All `Child2` where `vl2 > 6`
    • All `Child3` where `vl3 > 7`

    And in each `Child3` to load all of the `Child3Itm` content.

    I'm using this query:

    Dim lst = (From t In context.MasterTable.Where(Function(t1) t1.id = 7)
    Select New With {
    t,
    .chld1 = t.child1s.Where(Function(t21) t21.vl1 >5),
    .chld2 = t.child2s.Where(Function(t31) t31.vl2>6 ),
    .chld3 = t.child3s.Where(Function(t41) t41.vl3>7).Select(Function(t411) t411.Child3Itms)
    }).ToList

    The problem is that no `Child3` are selected. All others are OK. What can i do? Thanks in advance!

    Visual Basic database help question

  • Class as memebrs of other classes : Create a constructor that takes all data
    D desanti

    Hello ! I have 2 classes Books and Author. On of members of Books is of type Author. On Class Books I want to have a Constructor that takes all the parametres for book and for author : This is my code :

    class author
    {

    private :
    string name;
    string email;

    public :
    string get_name(){return name;}
    string get_email(){return email;}

    void  set\_name(string name){this->name=name;}
    void set\_email(string email){this->email=email;}
    
    
    author(string name,string email)
    
    {   this->name=name;
    
        this->email=email;
    
    }
    

    }

    class book
    {
    private :
    string title;
    int year;
    author auth;

    public:

    string get\_title(){return title;}
    int get\_year(){return year;}
    
    
    void  set\_title(string title){this->title=title;}
    void set\_year(float year){this->year=year;}
    
    book(string title, int year):author(string name,string email)
    {
       this->title=title;
       this->year=year;
      ???????
    }
    

    }

    I don't know how can i change the constructor of book in order that it takes all the perameter for book and for the author? Thank you !

    C / C++ / MFC question learning

  • Entity framework : a query is not working as expected
    D desanti

    Again , on Local Cache I have all the students.The same problem as my query on my first post.

    Visual Basic database csharp sql-server sysadmin

  • Entity framework : a query is not working as expected
    D desanti

    ok , but what's wrong with my query , and what should I do ?

    Visual Basic database csharp sql-server sysadmin

  • Entity framework : a query is not working as expected
    D desanti

    I have used LastOrDefault in other cases , and there were no problems translating in SQL Query. so I think there is a SQL equivalent for LastOrDefault.

    Visual Basic database csharp sql-server sysadmin

  • Entity framework : a query is not working as expected
    D desanti

    I've tried your solutions , and both produced the same error :

    LINQ to Entities does not recognize the method 'Program1.status LastOrDefault[status](System.Collections.Generic.IEnumerable`1[Program1.status])' method, and this method cannot be translated into a store expression.'

    Visual Basic database csharp sql-server sysadmin

  • Entity framework : a query is not working as expected
    D desanti

    Hello ! I'm using vb.net 2017 and Entity Framework 6 with sql server 2008r2. I have 2 tables in database : Studnets: (ID , Name ) Status : (ID , Year , Student_ID , Active ) The table status has the status of students in a specific year. A student may have 0 or 1 status on a year . ( If a student has not a status on a year , the last status from previous years ( if exists ) is used as a status for it this year) Now I want to have a query that load on local cache only the students that are active on a specific year. This is my query :

    Dim queryv As IEnumerable(Of students)
    queryv = (From t1 In context.students order by t.Name select t)
    queryv = (From t1 In queryv
    Let p = t1.status.Where(Function(t2) t2.year<=year1).OrderBy(Function(t3) t3.year).LastOrDefault
    Where Not IsNothing(p) AndAlso p.active = True
    Select t1)
    queryv.Tolist

    On Database there are 2 students , one of them has an Active status this year , the other has a non-active status. The problem is that after i excute that query , i have 2 instructions , just for testing :

    Messagebox.show(queryv.count)
    MessageBox.show(context.studnets.local.Count)

    The results are : 1 (for queryv) 2 (for local cache ) On Local cache both students exists. Why is this result ? Thank you !

    Visual Basic database csharp sql-server sysadmin

  • Force entity framework to load new data from database without disposing the context
    D desanti

    Then , really I don't understand why a such method does not exist on DBContext directly but I should use objectContext. Because the option StoreWins means that the local cache will be overwritten with new data on my database , we have discussed this on our conversation.

    Visual Basic database csharp algorithms help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups