public Boolean registerUser(String account, String password, int level) { string sql = @"INSERT INTO [user] ([account],[password],[category_id]) VALUES('" + account + "','" + password + "'," + level + ")"; ContentProvider provider = ContentProvider.getInstance(); int rowAffected = provider.insert(sql); return(rowAffected > 0); }
//public class Record //{ // public int index{get;set;} // public String category{get;set;} // public string description { get; set; } // public string code { get; set; } // public DateTime whenhappened { get; set; } // public DateTime whenresolved { get; set; } //} //record infomation runtime public static int write(WarnningDataSource.ErrorInfo info) { ContentProvider provider = ContentProvider.getInstance(); string sql = String.Format(@"INSERT INTO [warnning] ([level],[category_id],[code],[description],[whenhappened] ) VALUES({0},{1},'{2}','{3}','{4}')", info.level, info.category_id, info.code, info.description, DateTime.Now.ToString()); int rowAffected = provider.insert(sql); return(rowAffected); }
//record infomation runtime public static int write(int category, string description) { String time = DateTime.Now.ToString(); string sql = @"INSERT INTO [log] ([when],[category_id],[description]) VALUES('" + DateTime.Now.ToString() + "'," + category + ",'" + description + "')"; ContentProvider provider = ContentProvider.getInstance(); int rowAffected = provider.insert(sql); return(rowAffected); }