Thanks for the reply but LINQ still read the result of the Stored Procedure as INT.
On Error Jump Off the Building
Thanks for the reply but LINQ still read the result of the Stored Procedure as INT.
On Error Jump Off the Building
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
Find a new company that will satisfy you, that will hear you, that promotes team playing.
On Error Jump Off the Building
Focus on deployment, user controls, membership/authentication, integration with ado.net and the like. hth.
On Error Jump Off the Building
happy 8th year anniv!
On Error Jump Off the Building
haven't you tried to set the HeaderStyle-Width property of your BoundField columns to your desired width? like -> //mastereuo On Error GoTo Hell
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