Hi Umesh Hope this example will helps u:
DataAccessLayer
Class MyClass
{
public static int InsertData(MyBO bo)
{
string strQuery = "Insert into MyTable(a) Values('" + bo.A + "')";
SqlConnection con = new SqlConnection("<connection-string>");
con.Open();
SqlCommand com = new SqlCommand(strQuery,con);
com.CommandType = CommandType.Text;
com.ExecuteNonQuery();
}
}
BusinessObject
Class MyObject
{
public MyObject(){}
private string a
public string A
{
get{ return a;}
set{a=value;}
}
}
class MyObjectProcess
{
public static int InsertData(string strA)
{
MyObject obj = new MyObject();
obj.A = strA;
MyClass.InsertData(obj);
}
}
Application Layer
private btnAdd_Click(object sender, EventArgs e)
{
MyObjectProcess.InsertData(txtA.Text.Trim());
}
Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/
Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator