S
sippyuconn
Hi
Is there an more straightforward way of getting single value from a SQL
Query besides going to table and getting first column of first row ???
This is assuming that you know that you should only expect 1 value returned
Thanks
public static string GetGDesc()
{
string strCon;
string strSql;
OleDb.OleDbConnection oleCon = new OleDbConnection();
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=d:\My
Documents\TextFiles;Extended Properties=Text;"
strSql = "Select MyKey from MyTable WHERE MyName ='Steve'";
oleCon.ConnectionString = strCon;
oleCon.Open();
OleDbDataAdapter odaXL = new OleDbDataAdapter(strSql, oleCon);
odaXL.SelectCommand.ExecuteNonQuery();
DataSet ds = new DataSet("TextFiles");
objCon.Close();
if (ds.Tables[0].Rows.Count == 1)
{
sDesc = ds.Tables[0].Rows[0][0].ToString();
}
return (sDesc);
}
Is there an more straightforward way of getting single value from a SQL
Query besides going to table and getting first column of first row ???
This is assuming that you know that you should only expect 1 value returned
Thanks
public static string GetGDesc()
{
string strCon;
string strSql;
OleDb.OleDbConnection oleCon = new OleDbConnection();
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=d:\My
Documents\TextFiles;Extended Properties=Text;"
strSql = "Select MyKey from MyTable WHERE MyName ='Steve'";
oleCon.ConnectionString = strCon;
oleCon.Open();
OleDbDataAdapter odaXL = new OleDbDataAdapter(strSql, oleCon);
odaXL.SelectCommand.ExecuteNonQuery();
DataSet ds = new DataSet("TextFiles");
objCon.Close();
if (ds.Tables[0].Rows.Count == 1)
{
sDesc = ds.Tables[0].Rows[0][0].ToString();
}
return (sDesc);
}