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
U

unchecked

@unchecked
About
Posts
7
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • String command in SQL stored procedure return int result not records when called from LINQ TO SQL
    U unchecked

    Thanks for the reply but LINQ still read the result of the Stored Procedure as INT.

    On Error Jump Off the Building

    LINQ database help csharp linq question

  • String command in SQL stored procedure return int result not records when called from LINQ TO SQL
    U unchecked

    Since I found it hard for me to create Join using LINQ, I created a Stored Procedure for my select statement. I would just call the Store Procedure and presto I have my result sets. That is all fine if I have a straight select statement. The problem happens when I have a dynamic statement and I need to create command variable and then execute it using EXEC command from inside the Stored Procedure. When a statement is build in this manner, the LINQ TO SQL treated the result as int and not the INUMERABLE result.

    CREATE PROCEDURE dbo.GetAlumni (
    @batch int, @branch int, @fname varchar(25), @lname varchar(25), @location varchar(25)
    )
    AS
    declare @cmd varchar(8000)

    set @cmd = "select t.*, c.name as Cur_Country_Desc, b.name as Branch_Desc "
    set @cmd = @cmd + "from entiretable t "
    set @cmd = @cmd + "left join countries c on t.n_cur_country = c.code "
    set @cmd = @cmd + "left join branches b on t.branch_code = b.code "
    set @cmd = @cmd + "where t.batch = " + convert(char(4), @batch) + " "

    IF @branch IS NOT NULL
    BEGIN
    SET @cmd = @cmd + "AND t.branch_code = " + convert(char(1), @branch) + " "
    END

    IF @fname IS NOT NULL OR LEN(@fname) > 0
    BEGIN
    SET @cmd = @cmd + "AND t.N_FIRST_NAME LIKE '" + @fname + "%' "
    END

    IF @lname IS NOT NULL OR LEN(@lname) > 0
    BEGIN
    SET @cmd = @cmd + "AND t.N_LAST_NAME LIKE '" + @lname + "%' "
    END

    IF @location IS NOT NULL OR LEN(@location) > 0
    BEGIN
    SET @cmd = @cmd + "AND (t.N_CUR_TOWN_CITY LIKE '" + @location + "%' OR t.N_CUR_STATE_PROVINCE LIKE '" + @location + "%') "
    END

    exec (@cmd)

    I am calling that stored procedure using

        var db = new WITWAY\_DATADataContext();
        IEnumerable result = db.GetAlumni(batch, branch, fname, lname, location);
    

    and it throws an error 'Cannot implicitly convert type 'int' to System.Collections.Generic.IEnumerable' What's your implementation of this scenario? Thanks!

    On Error Jump Off the Building

    LINQ database help csharp linq question

  • Code reviews
    U unchecked

    Find a new company that will satisfy you, that will hear you, that promotes team playing.

    On Error Jump Off the Building

    The Lounge collaboration question code-review

  • MCTS .NET Web Developer Certification
    U unchecked

    Focus on deployment, user controls, membership/authentication, integration with ado.net and the like. hth.

    On Error Jump Off the Building

    The Lounge csharp architecture tutorial question

  • We're 8!
    U unchecked

    happy 8th year anniv!

    On Error Jump Off the Building

    The Lounge c++ php com sysadmin linux

  • How to retain Cell width in Datagrid? [modified]
    U unchecked

    haven't you tried to set the HeaderStyle-Width property of your BoundField columns to your desired width? like -> //mastereuo On Error GoTo Hell

    ASP.NET help css tutorial question

  • how to validate Dropdownlist in ASP.NET
    U unchecked

    Hi! What I did in my project is that, I inserted a new Listitem at index 0 of my dropdownlist with, say, value of "-1". then I added a CompareValidator control with properties: Type="String"; ControlToValidate="MyDropdownList"; ValueToCompare="-1" Operator="NotEqual"; coded like -> Note that the ValueToCompare's value is the same as the ListItem value I added to my dropdownlist, and the Operator is "NotEqual". hope it helps.. //mastereuo On Error Goto Hell

    ASP.NET help csharp asp-net tutorial
  • Login

  • Don't have an account? Register

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