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 : 7555 | Status : [Member] | Replies : 1
Hi,

presently i am developing windows forms.it 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)
connection.Close();
}
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;
}
}
}

Best,
Sudheep.



Responses

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

Up
0
Down
Hi,

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
https://blessybaby.wordpress.com/

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

Login to post response