public Double GetScalarRes(String CmdStr, SqlCommand SqlCmd, String strConArc) { // This function return only 1 value i.e. double value. // It takes Query String and execute it on SQL server and returns only one value. double Res = 0; try { // checking whether connection string from web.config file is "strConString". // accordingly setting the connection object. if (strConArc == "strConString1") { con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strConString1"]); } else { con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strConString"]); } con.Open(); if ((SqlCmd != null)) { SqlCmd.Connection = con; // returns only 1 value. //Res = Convert.ToDouble(SqlCmd.ExecuteScalar); Res = Convert.ToDouble(SqlCmd.ExecuteScalar()); } else { SqlCommand Cmd = new SqlCommand(CmdStr, con); // returns only 1 value. //Res = Convert.ToDouble(Cmd.ExecuteScalar); Res = Convert.ToDouble(SqlCmd.ExecuteScalar()); } // close connection. con.Close(); // return double value. return Res; } catch (Exception ex) { } }
ClsDatabase.GetDS(string, string, System.Data.DataSet, System.Data.SqlClient.SqlCommand)': not all code paths return a value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)