ExecuteNonQuery() публичный Метод

public ExecuteNonQuery ( String commStr ) : bool
commStr String
Результат bool
Пример #1
0
 public static bool DeleteTopic(int TopicId)
 {
     String commStr = "delete from Topic where id = "+TopicId;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #2
0
 public static bool ModifyMessage(int TopicId, String key, String values)
 {
     String commStr = "update Topic set " + key + " = '" + values + "' where id = " + TopicId;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #3
0
 public static bool ModifyMessage(String UserName,String key,String values)
 {
     String commStr = "update Users set " + key + " = '" + values + "' where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #4
0
 public static bool DeleteAnswer(int id)
 {
     String commStr = "delete from Answer where id = " + id;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #5
0
 public static bool DeleteFocusPart(String UserName, String Part)
 {
     String commStr = "update Users set FocusPart = '" + GetMessage(UserName, "FocusPart").Replace(Part+",","") + "' where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #6
0
 public static bool AddPoint(String UserName, int Point)
 {
     String commStr = "update Users set AccumulatePoint = " + (int.Parse(GetMessage(UserName, "AccumulatePoint"))+Point) + " where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #7
0
 public static bool CancelRecommandAnswer(int id)
 {
     String commStr = "update Answer set Recommand = 0 where id = " + id;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #8
0
 public static int PostTopic(String Author,String Title,String Part,String Text)
 {
     String commStr1 = "select max(id) as lastId from Topic";
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr1);
     int id = 0;
     if(r.Read())
         id = int.Parse(r[0].ToString())+1;
     r.Close();
     String date = DateTime.Now.ToShortDateString();
     String commStr2 = "insert into Topic values (" + id + ",'" + Author + "','" + date + "','"+ Title + "','" + Part + "','" + Text + "')";
     sql.ExecuteNonQuery(commStr2);
     sql.Dispose();
     return id;
 }
Пример #9
0
 public static bool PostTopic(String Author,String Title,String Part,String Text)
 {
     String commStr = "insert into Topic (Author,Date,Title,Part,Text) values ('" + Author + "',getdate(),'"+ Title + "','" + Part + "','" + Text + "')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #10
0
 public static bool Register(String UserName,String Password)
 {
     String commStr = "insert into Users values ('" + UserName + "','" + Password + "','','','',0,'')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Пример #11
0
 public static bool PostAnswer(int TopicId,String Author,String Text)
 {
     String commStr = "insert into Answer(TopicId,Author,Date,Text) values (" + TopicId + ",'" + Author + "',getdate(),'" + Text + "')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }