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
S

Syed Mehroz Alam

@Syed Mehroz Alam
About
Posts
106
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linq - how to write code for this query
    S Syed Mehroz Alam

    This should do the trick:

    var query = from row in dt.AsEnumerable()
    where row.Field<string>("MinValue") != null && row.Field<string>("MaxValue") != null
    group row by row.Field<string>("Name") into grp
    let maxServiceDate = grp.Max(r => r.Field<DateTime>("ServiceData"))

     from row in grp
     where row.Field<string;>("ServiceData") == maxServiceDate 
     select row
    

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ csharp database linq help tutorial

  • How to convert a field in a LINQ query
    S Syed Mehroz Alam

    Hi, This should be done on your GridView control using the DataFormatString property. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ question csharp css database linq

  • Linq - how to write code for this query
    S Syed Mehroz Alam

    Hi, In fact you need to get the latest record group by Name. Here's a post that describes such scenario: LINQ: How to get the latest/last record with a group by clause[^]. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ csharp database linq help tutorial

  • How to write Linq for this T-SQL
    S Syed Mehroz Alam

    You need to use the Contains operator;

    var list = new List { 1,2,3,.... };
    var query = dc.Table.Where( t=>list.Contains(t.ID) );

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ csharp database linq tutorial

  • Updating an edited article: Why not the CP built-in editor
    S Syed Mehroz Alam

    That's great, Thanks. :thumbsup:

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Site Bugs / Suggestions php html com collaboration tools

  • Updating an edited article: Why not the CP built-in editor
    S Syed Mehroz Alam

    Hi Chris, After an article is edited by the CP team, the article can no longer be modified using the wizard and hence we need to go through the whole process of getting its html, firing up an HTML editor, doing our modification, previewing in the browser, sending an email and then waiting for our turn so that a CP editor updates our article. How about letting the user modify the article as before (using the wizard/CP editor) with the only difference that the changes may not be reflected immediately, unless a CP editor approves it? Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Site Bugs / Suggestions php html com collaboration tools

  • Need help with code
    S Syed Mehroz Alam

    So you want to get parts that have no matching row in the Orders table. Here's a try:

    from np in MainMenu.db.Parts
    where
    np.Stock < np.OrderLevel
    &&
    (
    from o in MainMenu.db.Orders where o.PartID == np.PartID select o
    ).Count() == 0
    orderby np.StoreNumber
    select np;

    Hope that helps. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ database question help

  • [SOLVED] If i Wanted to check the values of two columns against the current object how would i do it with linq to sql ? [modified]
    S Syed Mehroz Alam

    Hi, You can join multiple conditions using && or ||. Also, I would prefer the use of Any method for this scenario:

    bool exists = db.Authors.Any(af => af.AuthorFirst == authors.AuthorFirst && af.AuthorLast == authors.AuthorLast);

    if (!exists) ...

    Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ database csharp linq question announcement

  • Is there a way to set initial visibility (collapsed or expanded) for a pre block inside an article?
    S Syed Mehroz Alam

    Currently, it looks that they are always expanded. Thanks,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Article Writing php com tools question

  • How to assign a query result to a stored procedure
    S Syed Mehroz Alam

    Hi, You need to enclose your select in parenthesis and include a top(1) clause, like this:

    Set @VideoId = ( Select top(1) VideoId from Videos where Title='Monkeydog' )

    Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database database help tutorial

  • pivot error
    S Syed Mehroz Alam

    Hi, Your Northwind db may not have compatibility level of 90 which is a requirement for the Pivot clause. Try this:

    ALTER DATABASE [NorthWind] SET COMPATIBILITY_LEVEL = 90

    Hope that helps. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database database sql-server sysadmin help question

  • SQL 2000 Query
    S Syed Mehroz Alam

    Hi, Looking at your data, it seems that you have a single entry per year in both the min and max result sets. If so, you can use derived tables, something like:

    Select ...
    From
    (
    --your first (min) query
    ) as SeasonStart
    Inner Join
    (
    --your second (max) query
    ) as SeasonEnd
    on SeasonStart.Year = SeasonEnd.Year

    Hope that helps. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database database

  • Join two tables of different servers in SSIS
    S Syed Mehroz Alam

    Hi Abhijit/CodeManiac, Expert exchange displays the answers at the bottom when your referrer is Google. Try searching for the question title "Linking, Connecting MS SQL 2000 to AS400 Database" using Google, go to the first result, and scroll down to the bottom of page to view the replies. Hope that helps. Regards,

    Syed Mehroz Alam My Blog | My Articles
    Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database sql-server database sysadmin question

  • Problem when creating query on base of combination
    S Syed Mehroz Alam

    Hi, A complex problem, but perhaps this[^] thread might be useful. Regards, Syed Mehroz Alam.

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database database csharp com help

  • checking duplicate rows using linq while inserting data.........
    S Syed Mehroz Alam

    Something like this might help:

    EmployeesDetailsDataContext DetailContext = new EmployeesDetailsDataContext();

    //check if there exists a record with the same First and Last Name
    bool exists = DetailContext.Employees.Any ( e => e.F_Name == txtFname.Text.Trim() && e.L_Name == txtLname.Text.Trim() )

    if (exists)
    //display message
    else
    //insert record

    Regards, Syed Mehroz Alam

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    LINQ help csharp database linq question

  • Creating a temporary table
    S Syed Mehroz Alam

    Have a look at pivot clause here[^] Regards, Syed Mehroz Alam

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database tutorial question

  • Query Problem ( INNER JOIN)
    S Syed Mehroz Alam

    How about using two joins like this:

    SELECT M.MID, M.MName, F1.FName, F2.Fname
    FROM Materials AS M
    INNER JOIN Function AS F1 ON M.FunctionID1=F1.FID
    INNER JOIN Function AS F2 ON M.FunctionID2=F2.FID
    WHERE FunctionID1 = X(input) and FunctionID2 = X(input)

    Regards, Syed Mehroz Alam

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database help database question

  • LINQ to XML in SL2 ?
    S Syed Mehroz Alam

    The same way as we do in an standard .NET 3.5 application. Here are some links for you: http://www.silverlightshow.net/items/Using-LINQ-to-XML-in-Silverlight-2.aspx[^] http://msdn.microsoft.com/en-us/library/cc189074(VS.95).aspx[^] And, if you having problems with some specific LINQ-to-XML query, try asking the experts at LINQ[^] forum. Hope that helps. Regards, Syed Mehroz Alam

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    WPF

  • Query help in SQL Server 2005
    S Syed Mehroz Alam

    Hi, You need to use SQL 2005's PIVOT statement. Have a look at examples here[^]. Regards, Syed Mehroz Alam.

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database

  • select upcoming birthday?
    S Syed Mehroz Alam

    Strange.. It works for me. Here are my test statements:

    declare @UsersProfile table
    (
    Person varchar(20),
    DOB datetime
    )

    insert into @UsersProfile
    select 'Person1', '2009-03-11'
    union select 'Person2', '2009-03-13'
    union select 'Person3', '2009-03-13'
    union select 'Person4', '2009-03-16'
    union select 'Person5', '2009-03-25'

    select * from @UsersProfile
    where DOB = ( select min(DOB) from @UsersProfile where DOB>GetDate() )

    Are you sure your DOB column is of DateTime type? Regards,

    My Blog My Articles Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

    Database database sql-server sysadmin tutorial question
  • Login

  • Don't have an account? Register

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