Click here to Skip to main content
15,867,330 members
Home / Discussions / Database
   

Database

 
QuestionSome help with SQL to Linq Conversions Pin
jkirkerx13-Jul-15 7:04
professionaljkirkerx13-Jul-15 7:04 
AnswerRe: Some help with SQL to Linq Conversions Pin
Richard Deeming13-Jul-15 7:18
mveRichard Deeming13-Jul-15 7:18 
GeneralRe: Some help with SQL to Linq Conversions Pin
jkirkerx13-Jul-15 7:34
professionaljkirkerx13-Jul-15 7:34 
General[Got It] Pin
jkirkerx13-Jul-15 7:58
professionaljkirkerx13-Jul-15 7:58 
GeneralRe: Some help with SQL to Linq Conversions Pin
Richard Deeming13-Jul-15 8:00
mveRichard Deeming13-Jul-15 8:00 
QuestionSQL Linq, query and then take result to query again Pin
jkirkerx10-Jul-15 7:43
professionaljkirkerx10-Jul-15 7:43 
So I thought I was getting this down now.
In my original code, I used 1 function to get the name, and another function to get the record results.

So I rewrote it Linq, But I'm not quite getting how it works.
So the first query called contributor returns a result that looks like SQL sort of, and says to expand to see the results.

The 2nd query does the same thing, and the pValue for the record count is non zero, and triggers an exception of non zero.

So I'm missing something on the concept here, and can't figure it out.
I shortened the sample for easier reading.
Public Shared Function load_movieContributor_array( _
        ByVal pMovieID As Integer,
        ByVal pPageIndex As Integer,
        ByVal pPageSize As Integer,
        ByRef pResults As IEnumerable(Of MovieIndex)) As Integer

        Dim pValue As Integer = 0

        Dim context As New MoviesContext()
        Dim contributor = _
            (From m In context.Movies
            Where m.MovieID = pMovieID
            Select m.MovieContributor)

        Dim movies As IQueryable(Of Movies) = context.Movies
        movies = movies.Where(Function(m) m.MovieContributor = contributor)
        movies = movies.OrderBy(Function(m) m.MovieName)

        'Get a Single Page of Data
        If (pPageIndex = 1) Then
            movies = movies.Take(pPageSize)
        Else
            movies = movies.Skip((pPageIndex - 1) * pPageSize).Take(pPageSize)
        End If

        pResults = _
            movies.AsEnumerable().Select(Function(item) New MovieIndex With
            {
                .MovieID = item.MovieID,
                'More columns .....
        })

        pValue = pResults.Count()

        Return pValue

    End Function

Answer[Solved] Pin
jkirkerx10-Jul-15 8:53
professionaljkirkerx10-Jul-15 8:53 
QuestionSELECT then INSERT data in a matrix way Pin
Farhad Eft9-Jul-15 9:14
Farhad Eft9-Jul-15 9:14 
AnswerRe: SELECT then INSERT data in a matrix way Pin
Richard Deeming9-Jul-15 9:22
mveRichard Deeming9-Jul-15 9:22 
GeneralRe: SELECT then INSERT data in a matrix way Pin
Farhad Eft9-Jul-15 10:51
Farhad Eft9-Jul-15 10:51 
QuestionSQL Linq, concepts of writing queries Pin
jkirkerx8-Jul-15 8:55
professionaljkirkerx8-Jul-15 8:55 
AnswerRe: SQL Linq, concepts of writing queries Pin
Richard Deeming8-Jul-15 10:46
mveRichard Deeming8-Jul-15 10:46 
GeneralRe: SQL Linq, concepts of writing queries Pin
jkirkerx8-Jul-15 12:32
professionaljkirkerx8-Jul-15 12:32 
Questionssrs rendering format ppt pptx Pin
Aurelkb5-Jul-15 23:35
Aurelkb5-Jul-15 23:35 
AnswerRe: ssrs rendering format ppt pptx Pin
Richard MacCutchan6-Jul-15 0:13
mveRichard MacCutchan6-Jul-15 0:13 
QuestionEvaluate returnvalues of stored procedures used in TableAdapterManager.UpdateAll Pin
atrus27113-Jul-15 1:49
atrus27113-Jul-15 1:49 
AnswerRe: Evaluate returnvalues of stored procedures used in TableAdapterManager.UpdateAll Pin
atrus27113-Jul-15 2:39
atrus27113-Jul-15 2:39 
QuestionOracle Query Builder Pin
Mycroft Holmes30-Jun-15 14:18
professionalMycroft Holmes30-Jun-15 14:18 
AnswerRe: Oracle Query Builder Pin
Jörgen Andersson7-Jul-15 8:40
professionalJörgen Andersson7-Jul-15 8:40 
QuestionEntity Framework 6.0.3 problem Pin
Mark Miller24-Jun-15 10:42
Mark Miller24-Jun-15 10:42 
AnswerRe: Entity Framework 6.0.3 problem Pin
Mark Miller1-Jul-15 9:49
Mark Miller1-Jul-15 9:49 
Questionstop accessing peoples SQL server through SQL management Studio. Pin
Azam Niaz Ch.21-Jun-15 9:06
Azam Niaz Ch.21-Jun-15 9:06 
AnswerRe: stop accessing peoples SQL server through SQL management Studio. Pin
PIEBALDconsult21-Jun-15 9:24
mvePIEBALDconsult21-Jun-15 9:24 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
Azam Niaz Ch.21-Jun-15 18:21
Azam Niaz Ch.21-Jun-15 18:21 
GeneralRe: stop accessing peoples SQL server through SQL management Studio. Pin
PIEBALDconsult21-Jun-15 18:28
mvePIEBALDconsult21-Jun-15 18:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.