sgmoore

About

Username
sgmoore
Joined
Visits
1,274
Last Active
Roles
Member
Points
74
Badges
9
  • Re: How to convert string to int for SQL?

    Your simple task is made more complicated by the fact that you have non-integer values in the column, eg 37E024

    I don't think Linq2Sql supports isNumeric, so you can either :
      fix your table structure and your data,
      use TSQL and IsNumeric or
      try to use not like to exclude the non-numeric data.
    For example, to exclude using a not like you could try
         from p in ProviderInfo
         where 
            !SqlMethods.Like(p.Provnum,"%[^0-9,.]%")        
              && 056428 == Convert.ToInt32( p.Provnum ) 
    ...
    
    The . and , are included in case you have values like "123,456" or "123.", but this can also return values like 123,456.78 and may throw errors with values like ",," , so this isn't really recommended if you can not control the sql data.
  • Re: Query results limited to 40 rows

    There seem to be some Linq Providers that limit the number of results if you don't specify how many you want. The solution is to use something like .Take(1000) or .Take(1000000) if you really can cope with a million records.
  • Re: How do I get monospaced results

    Edit/Preferences/Results.

    Set the Style Sheet for text (HTML) results to custom and click on Launch Editor and then you can add
    body
    {
    	margin: 0.3em 0.3em 0.4em 0.4em;
    	font-family: Consolas;
    	font-size: 80%;
    	background: white;
    }
  • Re: Grouping with List.

    Firstly, your example does not even compile, and as far as I know the standard JsconConvert will not produce output exactly like you describe, but ignoring these issues, it looks like you are grouping your csv by Location, ProductCode and ProductType and returning a List (or array) of ExpectedFormat objects, ie something like
    
    	 List<ExpectedFormat> output = (from r in listofSpecs
    	 group r by new { r.Location, r.ProductCode, r.ProductType } into results
    	 select new ExpectedFormat
    	 {
    		 Location       = results.Key.Location,
    		 ProductCode 	= results.Key.ProductCode,
    		 ProductType 	= results.Key.ProductType,
    		 Photopaths 	= results.Select(a => a.PhotoPath).ToList()
    	 }).ToList();
    	 
  • Re: Can I export hierarchical data to Excel?


    You could try something like
    Customers.Select(c => new { Orders = c.Orders.Select(o => new { c.Name, o.OrderDate} ) } ).SelectMany(r=>r.Orders);

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Badges