예제 #1
0
파일: Class1.cs 프로젝트: ripter/DBObject
 public void CreateWithConnectionThenQuery()
 {
     DBObject obj = new DBObject(Utility.connMy);
     obj.FillFromSelect("SELECT id, first_name, last_name, email FROM users WHERE id = @0", 1313);
     Assert.AreEqual("Chris", obj.Rows[0]["first_name"]);
 }
예제 #2
0
파일: Class1.cs 프로젝트: ripter/DBObject
 public void ThrowNoConnectionStringError()
 {
     DBObject obj = new DBObject();
     Assert.Throws<NoConnectionStringException>(delegate { obj.FillFromSelect("SELECT id, first_name, last_name, email FROM users WHERE id = @0", 1313); });
 }
예제 #3
0
파일: DBObject.cs 프로젝트: ripter/DBObject
 /// <summary>
 /// Filles the DBObject from the select query provided.
 /// </summary>
 /// <param name="select_query">Example: "SELECT * FROM user WHERE id=@0" </param>
 /// <param name="query_parameters">Numbered parameters for the select query. Example: "1"</param>
 /// <param name="connection_string">Connection string to use</param>
 /// <returns></returns>
 public static DBObject BySelect(string connection_string, string select_query, params object[] query_parameters)
 {
     DBObject obj = new DBObject(connection_string);
     obj.FillFromSelect(select_query, query_parameters);
     return obj;
 }