Skip to content

LINQ

LINQ (all flavours)

This category can be followed from the open social web via the handle linq-e04cf296@forum.codeproject.com

783 Topics 2.8k Posts
  • LINQ Query / "between" dates

    csharp database linq question
    2
    0 Votes
    2 Posts
    5 Views
    M
    Are begDate and endDate actually strings with the values "2007-11-18", "2007-12-31" respectively? And what is the type of data in row(1)? Is it also a string, or is it a date? If it is a date in that column, then it seems possible that taking the ToString() from date values is not using the same format as begDate and endDate are representing the date. I'd suggest doing the comparison as date (DateTime) values to avoid any issues with cultural-specific date formatting.
  • te

    php
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • 0 Votes
    2 Posts
    6 Views
    Richard DeemingR
    Try taking out the p1 = and p2 = from the LHS of your join. At the moment, you have: on new { p1 = ..., p2 = ...} equals new { LoanNum = ..., PmtPostDt = ... } The compiler has no way to map one key to the other, since the property names are different. Also, your LINQ join won't match your SQL join. The SQL has promise.PromiseDate < payment.PmtPostDt, but your LINQ query has promise.PromiseDate = payment.PmtPostDt instead. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • linq

    csharp linq question
    11
    0 Votes
    11 Posts
    31 Views
    T
    LINQ is the Language Integrated Query: http://en.wikipedia.org/wiki/Language_Integrated_Query[^]
  • Convert SQL to LINQ

    csharp database linq
    4
    0 Votes
    4 Posts
    11 Views
    E
    As Naerling and thatraja pointed out, there is no question, and we don't spood-feed, read the article thatraja linked, or if you are lazy brain-wise, buy Linqer (or any other SQL to LINQ conversion tool).
  • linq to sql obtain foreign key value

    csharp database sql-server linq sysadmin
    2
    0 Votes
    2 Posts
    7 Views
    R
    Hi, using (TransactionScope ts = new TransactionScope()) { InsertOnSubmit(tbl1); SubmitChanges(); int val1= tbl1.PrimaryKey; InsertOnSubmit(tbl2); SubmitChanges(); int val2= tbl1.foreignKey; if (strError == "") { SubmitChanges(); ts.Complete(); // now both inserts are committed to the db } }
  • 0 Votes
    1 Posts
    4 Views
    No one has replied
  • 0 Votes
    5 Posts
    15 Views
    M
    thanks for your help how could I : "don't SET NOCOUNT and return the result of it from the SP" ?!?!? thank you again
  • how to load and save an xml document using linq

    csharp linq xml help tutorial
    2
    0 Votes
    2 Posts
    8 Views
    W
    Go through this tutorial LINQ to XML - C# Tutorial[^]. This topic is too big to answer in a forum. Hope this helps. When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
  • 0 Votes
    2 Posts
    7 Views
    B
    Your problem is likely because the assembly seems to require the .NET framework 1.0, which is mot typically installed nowdays. See if there is a newer version, of if you have access to the source, update it yourself. If no source is available, try using ildasm to create an il file, and modify the references to point from 1 : 0 : 0 : 0 to 4 : 0 : 0 : 0 (remove the spaces, I added them to prevent a smiley from being inserted.) The references section should be at the top of the file. You can then use ilasm to recreate the assembly. Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions. Dave Barry Read more at [BrainyQuote](http://www.brainyquote.com/quotes/topics topic_technology.html#yAfSEbrfumitrteO.99)[^]
  • Creating a dynamic where clause

    csharp question python database visual-studio
    7
    0 Votes
    7 Posts
    21 Views
    S
    :laugh: Thanks for your help earlier Pete it works like a charm! Now onto my next crisis feature to include Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
  • Linq where dates question

    csharp database linq help question
    5
    0 Votes
    5 Posts
    13 Views
    M
    So...did it get solved?
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • linq to sql connection string name

    csharp database visual-studio question sql-server
    2
    0 Votes
    2 Posts
    8 Views
    B
    Can't you just edit the DBML file in text mode? I think it's human readable (XML?).
  • 0 Votes
    5 Posts
    16 Views
    Y
    There are several ways to solve this problem with link. I guess u wanted to return a boolean value indicating if the word found or not (of course you can mod the code to return a boolean). I decided to take a different approach that is fairly scalable..not the best code since i hacked it up in a few mins... string testWord = "word3"; // Returns the sentence with the word - this can be modded to return a boolean instead var sentenceWithSearchWord = sentences .Where(p => Regex.IsMatch(p, testWord) .FirstOrDefault(); // Splits the sentence returned to extract the single word. if (sentenceWithSearchWord != null) { string wordResult = sentenceWithSearchWord .Split(' ') .Where(p => Regex.IsMatch(p, testWord)) .First(); }
  • How can write vb SQL insert code in linq

    csharp database linq question
    3
    0 Votes
    3 Posts
    8 Views
    M
    :-O :rolleyes: :(( :sigh: :zzz: hi insert into tablename (seelct column4, column5, column6,.. from tablename1)
  • Linq to sql , one column is inserting NULL value ,

    database csharp linq help question
    3
    0 Votes
    3 Posts
    10 Views
    U
    i will try ur code in my office . hope it will work... i have auto increment value in idcount it will increment till one year when the next year start it will change to 1 again... i tried SET @idcount = SCOPE_IDENTITY().. but the value which is in idcount column is different than scope identity,which i try to display in message box ... how can i use return ? in this stored procedure so that the value which i am inserting should be displayed..?
  • 0 Votes
    2 Posts
    8 Views
    L
    Using data binding will run in the same thread in Windows Forms applications, however, in WPF you can specify the IsAsync property on a binding and have it execute asynchronously as you are hoping for. If you are using Windows Forms you would have to write something custom. More here [^].
  • 2 combos linked together - LINQ to Entities C# WinForms

    csharp winforms linq
    2
    0 Votes
    2 Posts
    7 Views
    J
    Does the event fire for comboBox1_TextChanged, if not rather try the SelectedIndexChanged event. If EmployeeID is an int, rather convert to toInt32 than toString, reason is that "1" != "1 ", so it is better practice to compare int values. Sami L wrote: (from t in Tsk where t.EmloyeeID.ToString() == comboBox1.SelectedValue.ToString() int selectedID; if(int.TryParse(comboBox1.SelectedValue.ToString(), out selectedID)) { comboBox2.DataSource = (from t in Tsk where t.EmloyeeID == selectedID select new { t.ID, t.TaskName }).ToList(); } To insert an empty value first in comboBox1 use the insert command after setting the datasource in the form load. the index will be 0 to insert as the first item. comboBox1.Items.Insert(index, object); No matter how long he who laughs last laughs, he who laughs first has a head start!
  • linq problem

    help csharp database linq tutorial
    7
    0 Votes
    7 Posts
    20 Views
    L
    Good link. Peace ON In Simple Sense... Start Shining Stories We Live...