public List <string> searchbyname(string name) { CacheCommand cc; idlist.Clear(); List <string> anamelist = new List <string>(); try { cc = new CacheCommand("Select AID, ANAME from ADBK WHERE ANAME %startswith ?", adbksrc.conn); CacheParameter cp = new CacheParameter("Name", CacheDbType.NVarChar); cp.Value = name; cc.Parameters.Add(cp); CacheDataReader reader = cc.ExecuteReader(); while (reader.Read()) { string id = reader[reader.GetOrdinal("AID")].ToString(); string aname = reader[reader.GetOrdinal("ANAME")].ToString(); anamelist.Add(aname); idlist.Add(id); } return(anamelist); } catch (Exception err) { MessageBox.Show("searchbynameエラー " + err.Message); return(anamelist); } //return anamelist; }
public List <string> searchbyname(string name) { idlist.Clear(); List <string> anamelist = new List <string>(); CacheCommand cc = User.ADBK.ByName(adbksrc.conn); CacheParameter cp = new CacheParameter("Name", CacheDbType.NVarChar); cp.Value = name; cc.Parameters.Add(cp); CacheDataReader reader = cc.ExecuteReader(); while (reader.Read()) { string id = reader[reader.GetOrdinal("AID")].ToString(); string aname = reader[reader.GetOrdinal("ANAME")].ToString(); anamelist.Add(aname); idlist.Add(id); } return(anamelist); }
public void updatedatamodel(CacheDataReader reader) { try { while (reader.Read()) { Age = (long)reader.GetInt32(reader.GetOrdinal("AAGE")); City = reader[reader.GetOrdinal("ACITY")].ToString(); HomePhone = reader[reader.GetOrdinal("APHHOME")].ToString(); Name = reader[reader.GetOrdinal("ANAME")].ToString(); Street = reader[reader.GetOrdinal("ASTREET")].ToString(); WorkPhone = reader[reader.GetOrdinal("APHWORK")].ToString(); ZipCode = reader[reader.GetOrdinal("AZIP")].ToString(); dob = reader.GetDate(reader.GetOrdinal("ABTHDAY")).ToShortDateString(); id = reader[reader.GetOrdinal("AID")].ToString(); newflag = false; } } catch (Exception err) { MessageBox.Show("CacheDataReaderエラー " + err.Message); } }