trunk/src/LythumOSL.Core/Data/Sql.cs
/// <summary>
/// Retrieves data from SQL then make they mapping
/// and returns dictionary
/// </summary>
/// <param name="sql">Sql query</param>
/// <param name="key">Field name which is key</param>
/// <param name="value">Field name which is value</param>
/// <returns></returns>
Retrieves data from SQL then make they mapping
and returns dictionary
Retrieves data from SQL then make they mapping and returns dictionary
public LythumDictionary<string, string> Query (string sql, string key, string value)
		{
			LythumDictionary<string, string> retVal = new LythumDictionary<string, string> ();
			DataTable table = Query (sql);
			if (table != null)
			{
				foreach (DataRow r in table.Rows)
				{
					retVal.Add (
						r[key].ToString (),
						r[value].ToString ());
				}
			}
			return retVal;
		}
public LythumDictionary < string , string > Query ( string sql , string key , string value ) { LythumDictionary < string , string > retVal = new LythumDictionary < string , string > ( ) ; DataTable table = Query ( sql ) ; if ( table != null ) { foreach ( DataRow r in table . Rows ) { retVal . Add ( r [ key ] . ToString ( ) , r [ value ] . ToString ( ) ) ; } } return retVal ; }
Retrieves data from SQL then make they mapping
and returns dictionary
Retrieves data from SQL then make they mapping and returns dictionary
None
sql
string
None
key
string
Field name which is key
Field name which is key
value
string
Field name which is value
Field name which is value