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
F

Fernando Soto

@Fernando Soto
About
Posts
68
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • trying to skip and jump elements in a list
    F Fernando Soto

    Hi cechode; The code snippet below will generate a sequence of integers that start at 5 and adds 12 to each previous value and will end with a value of 100 or less.

    IEnumerable<int> index = Enumerable.Range(5, 100).Where(idx => (idx % 7) == 5 && idx <= 100);

    Fernando

    LINQ

  • how to wait for ExecuteQuery to complete?
    F Fernando Soto

    Hi Stryder_1; Are you saying that doing this code still gives you a time out exception? DataClasses1DataContext db = new DataClasses1DataContext(); var con = db.Connection; con.Open(); // Do both your Linq queries here con.Close(); My dilemma is that if you are still getting a time out exception while the connection is open then I don't know what is going on then because the two executions are happening on the same connection, the second execution does not need to open the connection because it is already open. Fernando

    LINQ database help csharp css sql-server

  • how to wait for ExecuteQuery to complete?
    F Fernando Soto

    To your statement. "I don't want to put a pause there because I want to be sure the first has completed before continuing, not just guess that is is finished.", The ExecuteQuery method does not continue to the next exectueable statement in your code until it has received the results from that call. Most likely the problem is that the connection is timing out. You have two options you can take, 1 increase the timeout from the default of 30 seconds. or 2 open the connection yourself before the first call to ExecuteQuery and closing it just after the second call to ExecuteQuery. To increase the timeout you can do this just after creating a DataContext: DataContext.CommandTimeout = 40; Or Opening the connection : DataClasses1DataContext db = new DataClasses1DataContext(); var con = db.Connection; con.Open(); // Do your Linq queries here con.Close(); Fernando

    LINQ database help csharp css sql-server

  • Find missing elements
    F Fernando Soto

    Hi Collin; This can be done with linq as shown in the code snippet below.

    // Your values from Index property
    List<int> myElements = new List<int>() { 8, 5, 9, 3, 4 };

    // Create all integers from min value to max value in above collection
    var range = from n in Enumerable.Range(myElements.Min(), myElements.Max() - myElements.Min() + 1)
    select n;

    // Find all missing values
    List<int> result = range.Except(myElements).ToList();

    LINQ database tutorial question

  • How To Convert This To Linq
    F Fernando Soto

    Let say that the instantiated data context is db, then you query in Linq would be as follows :

    var r2 = from rtgr in db.mmlaspnet_RolesToGlobalRoles
    select rtgr.RoleId;
    var r1 = from r in db.aspnet_Roles
    where r2.Contains(r.RoleId)
    orderby r.RoleName
    select r;

    fereach( var roles in r1 )
    {
    Console.WriteLine("RoleID = {0} ....", role.RoleId, ...);
    }

    LINQ csharp asp-net linq help tutorial

  • LINQ To Datatable......................
    F Fernando Soto

    What is the source of the data to fill the DataTable and is the DataTable already instantiated?

    LINQ csharp database linq

  • Multiple dbml file in One Website
    F Fernando Soto

    It is not possible to define 2 DataContext and create a query that uses tables from both of them.

    LINQ database csharp linq

  • How to check controls created at runtime in a windows form application?
    F Fernando Soto

    Hi Amer Rehman; If you are using .Net Framework 2.0 or higher you can use the Control.ControlCollection.Find Method to find a control. The second parameter states to search all child controls as well as shown in the code snippet below.

    Private Function CheckControl(ByVal ctrlName As String) As Boolean

    Dim blnResult As Boolean = False
    
    If (Me.Controls.Find(ctrlName, True).Length > 0) Then
        blnResult = True
    End If
    
    Return blnResult
    

    End Function

    Fernando

    Visual Basic help tutorial question

  • how do i convert an RGB color to ConsoleColor?
    F Fernando Soto

    Hi Roland; The short answer is you cannot. The ConsoleColor is an enumeration which cannot be modified. Here is the link to the documentation of ConsoleColor: http://msdn.microsoft.com/en-us/library/system.consolecolor.aspx[^]

    .NET (Core and Framework) question

  • Error while binding data with gridview
    F Fernando Soto

    The DataBind is a method call and the syntax should be: this.GridView2.DataBind();

    LINQ wpf wcf help

  • splitting in VB.NET without delimiters
    F Fernando Soto

    Hi poojapande; You can use the ToCharArray method of the string class as shown in the code snippet.

    Dim geneSeq As String = "ATTATCGATGATATTATTGGTCTTATTTGT"
    Dim splitseq() As Char

    splitseq = geneSeq.ToCharArray()

    ' Display the splitseq array
    For Each ch As Char In splitseq
    Console.WriteLine(ch)
    Next

    Fernando

    .NET (Core and Framework) csharp database data-structures

  • Database connection
    F Fernando Soto

    Option 2 is the way to go. No need to tie up system resources when it is not being used.

    .NET (Core and Framework) database

  • LINQ help!!!
    F Fernando Soto

    It is the only way to get a flatten result set.

    LINQ csharp database linq help question

  • LINQ help!!!
    F Fernando Soto

    Hi ywang555; In the select statement explicitly select each field of c and cv. For example: Select New With {c.Field1, c.Field2, ... , c.Fieldn, cv.CoverageCode} Fernando

    LINQ csharp database linq help question

  • Get a string of number ?
    F Fernando Soto

    Hi dec82; you could use a regular expression to pull the numeric data out.

        ' Test data
        Dim testData As String = "abcd 36.2"
        ' String to hold the wanted info
        Dim numericValue As String = String.Empty
        ' A regular Expression to pull out the needed info
        Dim m As Match = Regex.Match(testData, "^.\*?(\\d+(?:\\.\\d+)?)")
        ' Test to see if the string had a numeric value on the end of it
        If m.Success Then
            ' Pull out the information
            numericValue = m.Groups(1).Value
        End If
    
        MessageBox.Show("Numeric Value = " & numericValue)
    

    Fernando

    Visual Basic tutorial question

  • Help for writing a LINQ query !
    F Fernando Soto

    Not a problem, glad to help.

    LINQ csharp database linq xml help

  • Help for writing a LINQ query !
    F Fernando Soto

    Hi Mohammad; This should do what you want.

    XElement xElement = XElement.Parse(xmlSTR);
    var max = (from q in xElement.Descendants("Part")
    let val = Convert.ToInt32(q.Attribute("ID").Value)
    orderby val descending
    select q).First();

    MessageBox.Show(max.ToString());

    Fernando

    LINQ csharp database linq xml help

  • Small Issue, Needs Urgent help
    F Fernando Soto

    Not a problem, glad I was able to help. :thumbsup:

    Visual Basic help tutorial com sales question

  • Help for writing a LINQ query !
    F Fernando Soto

    Hi Howard; This should do what you want.

    XElement xElement = XElement.Parse(xmlSTR);
    var max = (from q in xElement.Descendants("Part")
    let val = Convert.ToInt32(q.Attribute("ID").Value)
    orderby val descending
    select q).First();

    MessageBox.Show(max.ToString());

    Fernando

    LINQ csharp database linq xml help

  • How do you format the date time to just date?
    F Fernando Soto

    Hi Muhammad; This will display the date only

    ' Simulate date and time from the DB
    Dim dt As DateTime = Now

    ' This will display the date only
    MessageBox.Show(dt.ToString("MM/dd/yyyy"))

    Fernando

    Visual Basic database 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