ExecuteReader() 공개 메소드

public ExecuteReader ( String commStr ) : System.Data.SqlClient.SqlDataReader
commStr String
리턴 System.Data.SqlClient.SqlDataReader
예제 #1
0
 public static bool Login(String UserName,String Password)
 {
     String commStr = "select * from Users where UserName = '******' and Password = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteReader(commStr).Read();
     sql.Dispose();
     return f;
 }
예제 #2
0
 public static String GetMessage(int id, String key)
 {
     String ans = "";
     String commStr = "select " + key + " from Topic where id = " + id;
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr);
     if (r == null)
         return ans;
     if (r.Read())
         ans += r[0].ToString();
     r.Close();
     sql.Dispose();
     return ans;
 }
예제 #3
0
 public static String GetMessage(String UserName,String key)
 {
     String ans = "";
     String commStr = "select " + key + " from Users where UserName = '******'";
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr);
     if(r==null)
         return ans;
     if (r.Read())
         ans += r[0].ToString();
     r.Close();
     sql.Dispose();
     return ans;
 }
예제 #4
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;
 }