public static Class.Path getPathById(long id_path) { Class.Path dbpath = new Class.Path(); using (MySqlConnection conn = DataAccessBase.GetConnection()) { conn.Open(); MySqlCommand command = new MySqlCommand("GetDatabasePath", conn); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@idpath", id_path); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { dbpath.Id_path = reader.GetInt16(0); dbpath.DatabasePath = reader.GetString(1); } } } //} //catch (Exception ex) //{ // esito.esito = false; // esito.Message= ex.Message; //} return(dbpath); }
public static List <Class.Path> getPaths() { List <Class.Path> u = new List <Class.Path>(); using (MySqlConnection conn = DataAccessBase.GetConnection()) { conn.Open(); MySqlCommand command = new MySqlCommand("GetDatabasePath", conn); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@idpath", DBNull.Value); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Class.Path dbPath = new Class.Path(); dbPath.Id_path = reader.GetInt16(0); dbPath.DatabasePath = reader.GetString(1); u.Add(dbPath); } } } return(u); }
protected void gvPathLabeling_RowUpdating(object sender, GridViewUpdateEventArgs e) { int id_path = Convert.ToInt32(gvPathLabeling.DataKeys[e.RowIndex].Value.ToString()); Class.Path dbpath = DataAccess.DataAccessPath.getPathById(id_path); BindGv(dbpath.DatabasePath); lDatabaseFolders.InnerText = "Database: " + dbpath.DatabasePath; gvDirectory.Visible = true; //fDatabaseFolders.Visible = true; }
protected void gvPathLabeling_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { // get id user my datakey selected in the gridview int id_path = Convert.ToInt32(gvPathLabeling.DataKeys[e.NewSelectedIndex].Value); hddIdPath.Value = id_path.ToString(); Class.Path dbpath = DataAccess.DataAccessPath.getPathById(id_path); txtPathLabelingName.Text = dbpath.DatabasePath; fEditPath.Visible = true; DivSuccess.Visible = false; DivError.Visible = false; addPath.Visible = false; fDatabaseFolders.Visible = false; }