.net

using a stored procedure for login in c#

If I run a store procedure with two parameter values (admin, admin) (parameters : admin, admin) I get the following message : Session_UID User_Group_Name Sys_User_Name ------------------------------------ -------------------------------------------------- - NULLAdministratorsNTMSAdmin No rows affected. (1 row(s) returned) @...

Understanding CLR 2.0 Memory Model

Joe Duffy, gives 6 rules that describe the CLR 2.0+ memory model (it's actual implementation, not any ECMA standard) I'm writing down my attempt at figuring this out, mostly as a way of rubber ducking, but if I make a mistake in my logic, at least someone here will be able to catch it before it causes me grief. Rule 1: Data dependence ...

Is ToString() optimized by compiler?

Suppose I've following Code: Console.WriteLine("Value1: " + SomeEnum.Value1.ToString() + "\r\nValue2: " + SomeOtherEnum.Value2.ToString()); Will Compiler Optimize this to: Console.WriteLine("Value1: " + SomeEnum.Value1 + "\r\nValue2: " + SomeOtherEnum.Value2); I've checked it with IL Di...

Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)

I have a program with two methods. The first method takes two arrays as parameters, and performs an operation in which values from one array are conditionally written into the other, like so: void Blend(int[] dest, int[] src, int offset) { for (int i = 0; i < src.Length; i++) { int rdr = dest[i + offset]; dest[i...

All embedded databases fail to open connections

Hi, I'm working on a winforms desktop application that needs to store data. I made the really bad decision to try and embed a database. I've tried: SQLite VistaDB SQL Server Compact In each case, I was able to generate a Entity Framework Model over the basic schema I've created. I have an event that adds data that I've been using...

Can i use a generic implicit or explicit operator? C#

How do i change the following statement so it accepts any type instead of long? Now here is the catch, if there is no constructor i dont want it compiling. So if theres a constructor for string, long and double but no bool how do i have this one line work for all of these support types? ATM i just copied pasted it but i wouldnt like doi...

Gridview rowcommand after refreshing

I have a gridview inside an updatepanel. After updating the gridview, accessing the individual rows does not seem to give the right row. For example: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow row = ((e.CommandSource as Control).NamingContainer as GridViewRow); Ro...

How to Authenticate Gmail like Google Talk to open new emails in browser

I can read new emails using gmail pop3 in c#, I'm looking for a way to open each one of new emails in browser just like Google Talk When you receive new email Google talk notify you and if you click on message, you can read your email in browser new window. Any Idea? ...

I can't seem to find System.Collections.Concurrent on VS2010??

I've got VS2010 and im pretty sure .NET 4.0, as if i try to install it from MS it says do i wish to repair the current version- so i must have it. But i want to create a concurrent dictionary and i cant seem to find the correct packet. I went to references to add it manually but it wasnt in my list? ...

How Unicode strings can be passed from a managed to an unmanaged function...

I will really appreciate anybody's help about how a Unicode string can be passed (marshaled) from a managed (Delphi .NET) to an unmanaged (Delphi's Win32 DLL) function. The managed environment (Delphi .NET): ... interface ... const TM_PRO_CONVERTER = 'TM.PROFileConverter.dll'; function ImportLineworksFromPROFile(FileName :...

Two if conditions or one if with OR

I have a small doubt I have following code bool res= false; if(cond1) { res = true; } if(cond2) { res = true; } Instead of this if I put following code if(cond1 || cond2) { res = true; } Which code snippet will be more optimized? I believe it would be second one as I have avoided an If condition. ...

Protocol communication help..

Using Visual Studio 2005 Language: c# A new to c# I have software, the software should communicate with gprs devices. So i want to write a protocol, TCP, UDP communication code. Can any one give some idea for writing a source code and some sample code also. ...

Custom prerequsites to visual studio setup project

I have a Visual Studio Setup project and have followed the steps mentioned in this link to load the Shared Add-in Support Update for the Microsoft .NET Framework 2.0 (KB908002) to the prerequisites list. The entry appears but there is this following warning shown No 'HomeSite' attribute has been provided for 'Shared Add-in Support Upda...

webBrowser popup window loses session

I am using WebBrowser control of .NET to login into a website. When i click on a button that popups a new window the popup window asks me to login again. However i am not asked to login again if i open the webpage in internet explorer. Is there any way to make the WebBrowser control store session so that i do not have to login again on ...

VS2008: "Error whilst trying to run project:Unable to start program. The debugger's protocol is incompatibile with the debugee"

I think i know roughly why i'm getting this message. I opened a VS2008 project in VS2010, realised my code wont work with .NET 4, so i re opened it in VS2008 but now it wont build. Can someone advise me how i can get this back to executing? I deleted the debug folder and built again but nothing has changed. I also cleaned the project an...

How can I convert my DateTimeOffset to a Twitter Date/Time ?

Hi folks, How can I convert a DateTimeOffset.Now into a twitter-compatible date/time? Twitter example: <created_at>Tue Apr 07 22:52:51 +0000 2009</created_at> cheers :) ...

Coding style in .NET: whether to refactor into new method or not?

Hi As you aware, in .NET code-behind style, we already use a lot of function to accommodate those _Click function, _SelectedIndexChanged function etc etc. In our team there are some developer that make a function in the middle of .NET function, for example: public void Button_Click(object sender, EventArgs e) { some logic here.. ...

Registry System.UnauthorizedAccessException

hello, when I'm trying to create a subkey in Registry.ClassesRoot I get an System.UnauthorizedAccessException! I'm using win7. Does anyone know why? ...

.Net SvcUtil: attributes must be optional

Hi, I'm trying to generate C# code classes with SvcUtil.exe instead of Xsd.exe. The latter is giving me some problems. Command line: SvcUtil.exe myschema.xsd /dconly /ser:XmlSerializer Several SvcUtil problems are described and solved here: http://blog.shutupandcode.net/?p=761 One problem I can't solve is this one: Error: Type 'Dat...

.NET sources to download

Where can I download source code for the .NET Framework? I mean sources of libraries. I need the source for reflection methods like invoke and other. ...