Why Help Topics?

This section of my website is dedicated to random topics. Information here could contain anything from scripts, programs, instructions, etc. I added this section to my website because I ran into simple problems that hendered the production of my project and I assume that others might have the same fate. For example: Figuring out how to find the file path in C# on a remote server where you uploaded your website. If I can help at least one person find information that they are looking for, then I will feel as if I contributed to my community of developers.

Sql Server Cities and States Tables

If your developing a project that requires a database that has cities and states with a relationship between the two then you can download it below. I could not find this if my life depended on it so after I created it I decided that I should share it with the world so here it is. Please leave a comment or email me if you have any concerns or question.

DownLoad: StatesCities.xls

Note: The easiest way to add these tables to your database is to use Microsoft SQL Server Managment Studio: Right Clicking on the database you wish to add the tables to, Select Task, Select Import Data (When the Import Wizard ask for the destination select Microsoft Excel because the data is in an excel format) and follow the directions. Again if you have any question contact me. Enjoy!!!

Sending email using C#

This is actually pretty simple using the System.Net and System.Net.Mail namespaces of .Net. Here is the code.

   1:  using System.Net.Mail;
   2:  using System.Net;
   4:   protected void contactButton_Click(object sender, EventArgs e)
   5:   {
   6:       //Create an instance of the MailMessage class
   7:       MailMessage msg = new MailMessage();
   9:       //Set the properties
  10:       msg.To.Add(new MailAddress("your email here", "subject goes here"));
  11:       msg.From = new MailAddress("your email here", "display name here");
  13:       msg.Subject = "subject goes here";
  15:       msg.Body = "message goes here";
  16:       msg.IsBodyHtml = false;
  17:       msg.Priority = MailPriority.High;
  19:       SmtpClient c = new SmtpClient("your outgoing mail server here");
  20:       NetworkCredential cred = new NetworkCredential("your username
            for the email account"
, "your password for the email
  22:       c.Credentials = cred;
  23:       c.EnableSsl = true;
  24:       c.Send(msg);
  26:      }

Note: A couple of things to be noted. Credentials and EnableSsl are not required but are specific to which service you are using. For example my hosting service (godaddy.com) requires me to have my Credentials but does not allow Ssl to be enabled.

Application to Run Batch Files (Windows 7 Taskbar)

One annoying "feature" of the Windows 7 Takbar is the fact that you can't pin batch files to it. So I developed a simple application which you can pin to your taskbar that will then allow you to pin batch files to it. See Image Below

DownLoad: RunBatch.zip

Leave a comment

5+5 =


Posted By: Mat On: 3/28/2013 5:36:39 AMThanks for this, using quite happily on Win8.

Posted By: Billy On: 7/14/2012 11:52:18 AMThank you for the Run Batch app, it is very helpful to my and my tech team.

Posted By: Andreas On: 3/27/2012 4:57:44 PMNice! Would it be possible to post the source code for RunBatch?

Posted By: Simon Martin On: 6/3/2011 10:09:41 AMVery interesting c# mail :) and thanks for the cmd batch processor! Its on my task bar now!

Posted By: Steve Cummings On: 9/30/2010 9:37:01 PMMarvelous, really great for simple access to multiple batch files from Taskbar. Not a fix if you want one click start of one batch file.

Posted By: mhenry1384 On: 7/25/2011 2:27:23 PMThanks, just what I needed.