C sharp donet code to Get Single query Data . Use following code in common class .
static public string getSingleQueryData(string _Querystr)
{
string Connstr= "";
OleDbConnection connection = null;
OleDbDataAdapter adp = null;
OleDbCommandBuilder oleDbCommandBuilder = null;
DataTable dataTable = null;
string _strReturn = "";
Connstr= ConfigurationSettings.AppSettings["strconnection"];
connection = new OleDbConnection(strconnection);
connection.Open();
adp = new OleDbDataAdapter(_Querystr, connection);
oleDbCommandBuilder = new OleDbCommandBuilder(adp);
dataTable = new DataTable();
adp.Fill(dataTable);
connection.Close();
if (dataTable.Rows.Count > 0)
{
_strReturn = dataTable.Rows[0][0].ToString();
}
return _strReturn;
}