Пример #1
0
	public string Dlookup(string table, string field, string sWhere)
	{
		string sSQL = "SELECT " + field + " FROM " + table + " WHERE " + sWhere;

		OleDbCommand command = new OleDbCommand(sSQL, Connection);
		OleDbDataReader reader=command.ExecuteReader(CommandBehavior.SingleRow);
		string sReturn;

		if (reader.Read()) {
			sReturn = reader[0].ToString();
			if (sReturn == null)
			sReturn = "";
		} else {
			sReturn = "";
		}

		reader.Close();
		return Server.HTMLEncode(sReturn);
	}