I have created a Windows form application using C# in visual studio 2010 connecting the database in SQL server . After all my development is done i copy the exe file generated i
As you don't provide the error, the answers and comments you are getting are educated guesses.
You should check the event viewer for errors...
This will let you learn what is going on. If you can't fix it, add this info to your question.
As you are not posting exception message, probably you re not properly catching exceptions. Just to be sure surround your main function in a Try/Catch.
In Catch, write some code to dump message exception into a file, or even better use Log4Net. For simplicity just add some code to write to a file now. Something like:
static void Main()
{
try
{
//Your code
}
catch (Exception ex)
{
//Write ex.Message to a file
using (StreamWriter outfile = new StreamWriter(@".\error.txt"))
{
outfile.Write(ex.Message.ToString());
}
}
}
PS: If it is a console application you can survive with Console.Write