public string GetDatabaseValues(string value) { string strCon = System.Configuration.ConfigurationManager.ConnectionStrings["RestAPIConnectionString"].ConnectionString; string str = ""; using (SqlConnection myConnection = new SqlConnection(strCon)) { using (SqlCommand cmd = new SqlCommand(@"select Result from Output where Moviename=@0", myConnection)) { try { myConnection.Open(); cmd.Parameters.AddWithValue("@0", value); str = cmd.ExecuteScalar().ToString(); } catch (Exception e) { throw e; } finally { myConnection.Close(); myConnection.Dispose(); } } } return str; }
str = Convert.ToString( cmd.ExecuteScalar());
cmd.ExecuteScalar()
null
member
null object
Object reference
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)