CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    4

    Question C# - show result after running "static void Main()"

    Hi all,

    my need is to show result after running this code:

    Code:
            static void Main()
            {
                DBConnect dbconnect = new DBConnect();
                dbconnect.OpenConnectionPublic();
    
                dbconnect.CloseConnectionPublic();
            }
    It runs without error, but I can't see if it really works. Please help me, I'm new to C#.

  2. #2
    Join Date
    Jul 2012
    Posts
    90

    Re: C# - show result after running "static void Main()"

    Code:
    Console.WriteLine("Desired output here");

  3. #3
    Join Date
    Sep 2012
    Posts
    4

    Re: C# - show result after running "static void Main()"

    Now my code works fine in Window Forms:

    static void Main()
    {
    DBConnect dbconnect = new DBConnect();

    using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Temp\WriteLines4.txt", true))
    {
    file.WriteLine(dbconnect.CountPublic());
    }

    dbconnect.CloseConnectionPublic();
    }
    It connects to database, counts rows in table, writes result into txt file and closes connection.

    Now my need is to show result in silverlight (web page) instead of writing into txt file. How do I start?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+)
    Join Date
    Aug 2004
    Posts
    10,339

    Re: C# - show result after running "static void Main()"

    Quote Originally Posted by Efes View Post
    Now my code works fine in Window Forms:



    It connects to database, counts rows in table, writes result into txt file and closes connection.

    Now my need is to show result in silverlight (web page) instead of writing into txt file. How do I start?
    You start by creating a SilverLight application project instead of a console project.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width