[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
bool createdNew;
// To prevent the program to be started twice
///Create new mutex
System.Threading.Mutex appMutex = new System.Threading.Mutex (true, Application.ProductName, out createdNew);
///if creation of mutex is successful
if (createdNew)
{
Application.Run(new frmServer());
appMutex.ReleaseMutex();
}
else
{
/// if the app's already running
string msg = String.Format("The Program \"{0}\" is already running", Application.ProductName);
MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
Prevent duplicate execute of my program ?
I use the following code in the program.cs - file in C# 2.0:
Using .NET to Send Email
E-mail is one of the most common and reliable methods of communication for both personal and business purposes. It also plays an important role in each and every Web site. This role will be in the type of automated e-mails from the server after posting information from a form. You may have noticed these types of e-mails while registering on a site. As soon as you post the form, the server will send an e-mail asking you to confirm either your registration or with the information you entered. If you have to confirm the registration, the server will send you a long URL that you have to click to proceed further with the registration process. A classic example of this functionality is ASP.NET forums. As soon as you register, you will be e-mailed a random password. You will also get e-mails after your post has been accepted by a moderator or if somebody replies to your post. If you are wondering that this is a server magic—it is not. The whole process is made possible with the help of server-side programming languages such as ASP and ASP.NET.
Connection.Execute and Command.Execute
Command.Execute is more versatile, gives you more options, is probably more efficient. It allows you to setup parameters for your sql statements, stored procedures, create Prepared statements etc. You can retrieve information from stored procedure Output and Return Value parameters. It is more work to implement but in my mind worth the effort. It is not limited to stored procedures.
Personally, I never use Connection.Execute.
Personally, I never use Connection.Execute.
Subscribe to:
Posts (Atom)