public string deleteLayer(string layer, string oid) { string query = "delete from " + layer + " where " + layer + ".OBJECTID = " + oid; dataSource = new AccessDataSource(); dataSource.DataFile = @"E:\\WebSites\\StreetSignInventory\\Database\\Database.mdb"; dataSource.DeleteCommand = query; dataSource.Delete(); return("{\"val\" : true}"); }
protected void Gridview1_OnRowDeleting(object sender, GridViewDeleteEventArgs e) { AccessDataSource vd2 = new AccessDataSource(); vd2.DataFile = Server.MapPath(".") + "//App_Data/db1.mdb"; vd2.DeleteCommandType = SqlDataSourceCommandType.Text; vd2.DeleteCommand = "Delete from chuyenbay where macb=@TS"; vd2.DeleteParameters.Add("TS", TypeCode.String, GridView1.Rows[e.RowIndex].Cells[1].Text); vd2.Delete(); AccessDataSource vd3 = new AccessDataSource(); vd3.DataFile = Server.MapPath(".") + "//App_Data/db1.mdb"; vd3.SelectCommandType = SqlDataSourceCommandType.Text; vd3.SelectCommand = "Select * from chuyenbay"; GridView1.DataSource = vd3; GridView1.DataBind(); }