Posts by Paulo Morgado • 523 points
13 posts
-
4
votes1
answer226
viewsA: How to make "OR" between Subquerys using LINQ C#
A chain of wheres is a AND. If you want a OR, puts a OR: return (from t1 in Session.Query<Tabela1>() join t2 in Session.Query<Tabela2>() on t1 equals t2.T1 where (from t3 in…
-
6
votes2
answers483
viewsA: Like taking multiple groups in a Regex?
As an alternative to Filipe’s solution, here’s something else for you to learn. Your implementation blocks the UI when it is downloading page content, which is not a good user experience. With .NET…
-
1
votes1
answer1215
viewsA: Process.Start(variable) to open an application without knowing the installation location
If you want to launch the app from a specific location, then you need to know where it is. I recommend not to put that location in your code but to use a configuration file. For example, use…
-
1
votes2
answers2456
viewsA: End a C# process with WPF
ATTENTION: Although I have already used/tested all these techniques, I have never built any application as I will describe here. The executable IASD.ASCS.WPF.vshost.exe is the Visual Studio hosting…
-
2
votes3
answers5346
viewsA: Clone class objects using Icloneable
The concept of cloning objects can have two implementations: Shallow (rasa): Clones the object but copies only the references to the objects it references, except for the types by value (value…
c#answered Paulo Morgado 523 -
4
votes2
answers2189
viewsA: Convert Date dd/mm/yyyy to ISO 8601 format (yyyy-mm-dd)
If you have to interpret a specific format independent of culture, use the Parseexact.Datetime method: DateTime.ParseExact("01/04/2014", "dd/MM/yyyy", CultureInfo.InvariantCulture) I never used…
-
3
votes1
answer261
viewsA: XML returning incorrect values
The selection by label name (tag name) is always dangerous because one can fall in cases like this where elements with the same label name have different meaning. In this case…
-
2
votes2
answers741
viewsA: Definition and utility of partial class
Although often referred to as partial classes (or partial types), it is actually a partial definition that is governed by section §10.2 of the specification. It is usually used by generated code and…
c#answered Paulo Morgado 523 -
1
votes2
answers1148
viewsA: How to change the return url when directing to the login page?
The only way I see you doing that is by implementing your own authentication HTTP module. You can see here the implementation of FormsAuthenticationModule that controls Forms authentication.…
-
1
votes3
answers1948
viewsA: Set value of a null or Empty ROW on a gridview
The value corresponding to NULL of the database is: DBNull.Value. Try it this way: DataTable dt = ClassesControle.CNProduto.listaProdutos(null, usuario); foreach (DataRow row in dt.Rows) { if…
-
4
votes2
answers351
viewsA: How to recover from an Exception and send data from it?
ASP.NET captures the untreated exceptions and makes them available for treatment on error event of httpapplication class (representing the ASP.NET application). In most cases these exceptions are…
-
0
votes1
answer43
viewsA: Windows Mobile 5 error read XML
You’re having two problems: You’re not specifying the namespace Descendents will find all descendants. Including the Vs within the Vs. Try it like this: var EmpData = from emp in…
-
2
votes5
answers1056
viewsA: How do I connect Windows Phone to an SQL Server?
If the requirement is to connect to SQL Server with nothing else, it is always possible create a SOAP endpoint.