Click here to Skip to main content
15,892,697 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
arnold_w1-Aug-20 6:51
arnold_w1-Aug-20 6:51 
GeneralRe: How can I get handle (IntPtr) to a "sub"-form in another application? Pin
Richard Andrew x641-Aug-20 7:05
professionalRichard Andrew x641-Aug-20 7:05 
QuestionAzure Active Directory question Pin
pkfox31-Jul-20 0:50
professionalpkfox31-Jul-20 0:50 
AnswerRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 0:01
mveRichard Deeming4-Aug-20 0:01 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 3:36
professionalpkfox4-Aug-20 3:36 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 3:40
mveRichard Deeming4-Aug-20 3:40 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 5:38
professionalpkfox4-Aug-20 5:38 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 5:48
mveRichard Deeming4-Aug-20 5:48 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 6:52
professionalpkfox4-Aug-20 6:52 
GeneralRe: Azure Active Directory question Pin
Richard Deeming4-Aug-20 23:14
mveRichard Deeming4-Aug-20 23:14 
GeneralRe: Azure Active Directory question Pin
pkfox5-Aug-20 3:12
professionalpkfox5-Aug-20 3:12 
GeneralRe: Azure Active Directory question Pin
pkfox4-Aug-20 23:12
professionalpkfox4-Aug-20 23:12 
QuestionHow to change the aspect ratio of an Windows media player by using C# Pin
Member 1488657531-Jul-20 0:25
Member 1488657531-Jul-20 0:25 
AnswerRe: How to change the aspect ratio of an Windows media player by using C# Pin
Gerry Schmitz31-Jul-20 7:32
mveGerry Schmitz31-Jul-20 7:32 
QuestionName Generator Pin
Brandnoob30-Jul-20 8:04
Brandnoob30-Jul-20 8:04 
AnswerRe: Name Generator Pin
Gerry Schmitz30-Jul-20 8:10
mveGerry Schmitz30-Jul-20 8:10 
AnswerRe: Name Generator Pin
OriginalGriff30-Jul-20 8:55
mveOriginalGriff30-Jul-20 8:55 
QuestionExecuteScalar to cshtml view Pin
Member 1490312930-Jul-20 5:30
Member 1490312930-Jul-20 5:30 
I am new to .net core and have a question about the functional use of a method that retrieves a single value from a query. Using an MVC pattern, do I need to build a model (entity) for the result?

<pre>public string Line1Today()
        {
            string line1LbsToday = "";
            using (MySqlConnection conn = GetConnection())
            {
                try
                {
                    conn.Open();
                    MySqlCommand cmd = new MySqlCommand("select SUM(value) from tbl1", conn);

                    line1LbsToday = cmd.ExecuteScalar().ToString();
                }
                catch (System.Exception ex)
                {
                    return ex.ToString();
                }
                finally
                {
                    conn.Close();
                }

            }
            return line1LbsToday;

        }



I would like the return value to be sent to a view with some HTML formatting that I have set up. I realize this is quite a trivial question...but I am stuck...i can return whole table results to views, but I am looking for one single scalar value and can't seem to figure out the right approach. Any help would be greatly appreciated.
AnswerRe: ExecuteScalar to cshtml view Pin
Gerry Schmitz30-Jul-20 8:02
mveGerry Schmitz30-Jul-20 8:02 
GeneralRe: ExecuteScalar to cshtml view Pin
Member 1490312930-Jul-20 11:42
Member 1490312930-Jul-20 11:42 
GeneralRe: ExecuteScalar to cshtml view Pin
Dave Kreskowiak30-Jul-20 12:47
mveDave Kreskowiak30-Jul-20 12:47 
GeneralRe: ExecuteScalar to cshtml view Pin
Member 1490312930-Jul-20 12:55
Member 1490312930-Jul-20 12:55 
GeneralRe: ExecuteScalar to cshtml view Pin
Dave Kreskowiak30-Jul-20 13:17
mveDave Kreskowiak30-Jul-20 13:17 
GeneralRe: ExecuteScalar to cshtml view Pin
Member 1490312930-Jul-20 13:26
Member 1490312930-Jul-20 13:26 
GeneralRe: ExecuteScalar to cshtml view Pin
Dave Kreskowiak30-Jul-20 17:10
mveDave Kreskowiak30-Jul-20 17:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.