Vicomi

================ App Code --> Services -==============

 [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }

    [WebMethod]
    public void insertEmployeeService(string eid, string  name, string house, string street, string city, string tel)
    {
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "insert into TechOneEmployee values ('"+eid+"','"+name+"', '"+house+"', '"+street+"','"+city+"','"+tel+"');";
        cmd.ExecuteNonQuery();

        conn.Close();
    }

    [WebMethod]
    public DataSet ViewEmployee()
    {
     
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "select * from TechOneEmployee;";

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds, "TechOneEmployee");
        conn.Close();

        return ds;
    }

    [WebMethod]
    public void DeleteEmployee(string eid)
    {
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "delete from TechOneEmployee where eid='"+eid+"'";
        cmd.ExecuteNonQuery();

        conn.Close();

    }

    [WebMethod]
    public void UpdateEmployee(string eid, string name, string house, string street, string city, string tel)
    {
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "update TechOneEmployee set name='"+name+"', house='"+house+"', street='"+street+"', city='"+city+"', tel='"+tel+"' where eid='"+eid+"'";
        cmd.ExecuteNonQuery();

        conn.Close();
    }

================================================

====================== ASP Web/ Statnd Alone / MVC -----------

 localhost.Service employee = new localhost.Service();
            employee.insertEmployeeService(eid, name, house, street, city, tel);

------------------------------------------------------

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Vicomi

cmt

Contact Form

Name

Email *

Message *

Dialog

    Popular Post

    Blogger templates

    Powered by Blogger.

    - Copyright © Testing -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -