does not contain a static 'Main' method suitable for an entry point?

Posted by Sudheep.grandhe under C# on 1/16/2012 | Points: 10 | Views : 6625 | Status : [Member] | Replies : 1

presently i am developing windows shows the following error.please correct it.

Error1:Program 'D:\PetStore\PetStoree.PSDataLayer\obj\Debug\PetStoree.PSDataLayer.exe' does not contain a static 'Main' method suitable for an entry point PetStoree.PSDataLayer

namespace PetStoree.PSDataLayer
public static class DBConnection
static string provider = ConfigurationManager.AppSettings["provider"].ToString();
static string conStr = ConfigurationManager.AppSettings["CnStr"].ToString();
public static DbConnection connection = null;
public static DbCommand command = null;
static DbProviderFactory factory;

public static DbConnection GetConnection()
string provider = ConfigurationManager.AppSettings["provider"].ToString();
string conStr = ConfigurationManager.AppSettings["petstore09"].ToString();
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = conStr;
return connection;

public static void CloseConnection()
if (connection != null)
public static DbCommand GetCommand()
string provider = ConfigurationManager.AppSettings["provider"].ToString();
factory = DbProviderFactories.GetFactory(provider);
DbCommand command = factory.CreateCommand();
command.Connection = connection;
return command;
public static DbDataAdapter GetDataAdapter()
DbDataAdapter dda = factory.CreateDataAdapter();
return dda;
public static DbParameter GetDataParameter()
DbParameter dp = factory.CreateParameter();
return dp;



Posted by: Blessyjees on: 1/18/2012 [Member] Bronze | Points: 25


This error means that your project does not contains main method start the application. I think that this is your class library and you wrongly start this, right?

Blessy Baby
Digitalmesh Softech pvt Ltd

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response