hi guys! i have a code below that query something from my database
but how can I check if it does return any value or not and if it does how can i retrieve the value? thanks.Code:string SqlConnStr = Properties.Settings.Default.MyConnString; sqlConn = new SqlConnection(SqlConnStr); sqlConn.Open(); string qryStr = "Select Max(number) from docs_ref"; SqlCommand SqlCmd = new SqlCommand(qryStr, sqlConn); object result = SqlCmd.ExecuteScalar(); SqlCmd.Connection.Close(); sqlConn.Close();


Reply With Quote
