I have a simple SQL query:
Select ID, COUNT(ID) as Selections, OptionName, SUM(Units) as Units
FROM tbl_Results
GROUP BY ID, OptionName
The results I got were:
'1' '4' 'Approved' '40'
'2' '1' 'Rejected' '19'
'3' '2' 'Not Decided' '12'
I have to encrypt the data in the database, and as such am unable to sum the data in relati...
I have starter new System.Diagnostics.Process and it launchs FireFox. How can I obtain the Handler of that window? Any ideas - C#, winAPI functions... anything (just not ASM ;) )
...
Hi Guys, So i've got this little static method in a .Net class which takes a string, uses some stored public key and returns the encrypted version of that key. This is basically so some user entered data can be saved an encrypted, then retrieved and decrypted at a later date. Pretty basic stuff and the unit test works fine.
However, ...
Hi,
Please consider the following three .NET types: I have an interface, an abstract class, and a concrete class. My question is how to write the XML Schema to include the properties from the interface and from the abstract class.
public interface IStartable
{
bool RequiresKey { get; set; }
void Start(object key);
}
public a...
In my application I'm using ntrights.exe, that is part of Windows Resource Kit, to grant and revoke a specific user right.
For example to grant a user "Log on as a server" right, I execute using shell object following command:
ntrights -u User +r SeServiceLogonRight
However ntrights doesn't allow you to check if a user has a specific...
Hi, how do I find out the return type of a method from the MethodBase? I'm using PostSharp and trying to override the CompileTimeValidate(MethodBase method) method to make sure the attribute is applied to a method with the correct signature.
Thanks,
...
Hi:
I am building a program that uses a very simple plugin system. This is the code I'm using to load the possible plugins:
public interface IPlugin
{
string Name { get; }
string Description { get; }
bool Execute(System.Windows.Forms.IWin32Window parent);
}
private void loadPlugins()
{
int idx = 0;
strin...
Given a dictionary of <string, Drink>, how would you bind the dictionary.Values to a WPF ListBox, so that the items use the .Name property?
struct Drink
{
public string Name { get; private set; }
public int Popularity { get; private set; }
public Drink ( string name, int popularity )
: this ( )
{
this.Na...
I'm deploying an example SQL CLR stored procedure which has a SQL CLR type as parameter using Visual Studio 2008 and menu Project -> Deploy.
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void TakeTariff(TariffInfo tariffInfo) { }
}
public class TariffInfo
{
public SqlDecimal...
I have an UserControl and would like to hide the resizing handles in design-time, just like the TextBoxControl, that has only two handles (left and right ones)... the height of the textbox is fixed, unless you say it is multiline. In that case, the textbox shows all nine resizing handles.
...
Hi,
I'm trying to return a complex type from a service method in WCF. I'm using C# and .NET 4. This complex type is meant to be invariant (the same way .net strings are). Furthermore, the service only returns it and never recieves it as an argument.
If I try to define only getters on properties I get a run time error. I guess this is b...
I think I may be a bit confused on the syntax of the Moq Callback methods. When I try to do something like this:
IFilter filter = new Filter();
List<IFoo> objects = new List<IFoo> { new Foo(), new Foo() };
IQueryable myFilteredFoos = null;
mockObject.Setup(m => m.GetByFilter(It.IsAny<IFilter>())).Callback( (IFilter filter) => myFilte...
I have ListView that has the following EditItemTemplate:
<EditItemTemplate>
<tr style="">
<td>
<asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="CancelButton" runat="server" CommandName...
Hi. I have an issue with System.Threading.Timer. I am scheduling some actions using a time in a windows service. The timer starts executing the callback after a specified dueTime period. The windows service starts up after reboot automatically. However, I have observed a strange thing after a system reboot- the callback method starts exe...
I am returning File result from action triggered by the form post event.
I can't get download dialog. Instead, if I use:
return File(Encoding.UTF8.GetBytes(reportPath), "text/plain", "Report.csv");
I get path to the file upon ajax execution in the target div.
When I use
return File(reportPath, "text/plain", "Report.csv");
I get c...
I am writing a client-side .NET application which is expected to use a lot of threads. I was warned that .NET performance is very bad when it comes to concurrency. While I am not writing a real-time application, I want to make sure my application is scalable (i.e. allows many threads) and is somehow comparable to an equivalent C++ applic...
I am working with a service that is sending MIME attachments over an http request response are there any .net library for this kind of server? All I seem to find want to deal with email messages.
...
void TheSettings_PropertyChanged(object sender,
System.ComponentModel.PropertyChangedEventArgs e)
{
var settings = IsolatedStorageSettings.ApplicationSettings[StorageSettings]
as Dictionary<string, string>;
settings[e.PropertyName]= //call the method that has the same...
I'm trying to use Enumerable.ToList() in PowerShell. Apparently, to do that, I have to explicitly convert the object to IEnumerable<CustomType>, but I am unable to do that. It seems I can't correctly write IEnumerable<CustomType> in PowerShell. Both IEnumerable<string> and CustomType itself work correctly (the custom type I'm trying to u...
Hi,
I'm trying to implement an UPnP MediaServer in WCF. I'm slowly getting there, but now I've hit a brick wall. I need to add a prefix to the ServiceContract namespace. Right now I have the following:
[ServiceContract(Namespace = "urn:schemas-upnp-org:service:ContentDirectory:1")]
public interface IContentDirectory
{
[OperationCo...