Immediate Help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Immediate Help

  1. #1
    Adnan Badar Guest

    Immediate Help


    Hi,
    Would anyone please help me in finding following information.
    1_ What is the solution of Data Base connectivity in the C#.
    2_ Is multithreading in C# possible. How?
    3_ How can we do server & Client side programming in C#.
    Please tell me about these or any one you know about.Also tell me the rlevent
    sides where I can find the related information about these.
    Share on Google+

  2. #2
    Maher Dahdour Guest

    Re: Immediate Help


    "Adnan Badar" <adnan_badar@yahoo.com> wrote:
    >
    >Hi,
    >Would anyone please help me in finding following information.
    >1_ What is the solution of Data Base connectivity in the C#.
    >2_ Is multithreading in C# possible. How?
    >3_ How can we do server & Client side programming in C#.
    >Please tell me about these or any one you know about.Also tell me the rlevent
    >sides where I can find the related information about these.



    1. Database connectivity will be done by ADO.Net (Activex Data Object) by
    creating DSN (), or by connection string.

    String strConnection = "Provider= SQLOLEDB.1; Data Source=localhost; uid=sa;
    pwd=; Initial Catalog=northwind";


    Quick Example:

    m_ADOConnection = new ADOConnection (strConnection);
    m_ADOConnection.Open ();

    ' Do your work

    if ((m_ConnectionState & DBObjectState.Open) != 0)
    {
    m_ADOConnection.Close ();
    m_ConnectionState = m_ADOConnection.State;
    }


    ADO.NET will still be available for use.

    2. Multithreading issue is really a conceptual and complicated issue.To
    answer your question yes multithreading in C# is possible. If you are familiar
    with MFC and the implementation of multithreading you will be fine.
    If you are a VB programmer -VB has no multithreading- you need to understand
    the concept of multithreading in MFC and how is it implemented.

    Here is an example I hope it will help.
    Quick example:


    First Define Namespace
    using System.Threading;

    Second Start

    thread = new Thread(new ThreadStart( WriteData ));
    thread.Start();

    Third Execute


    protected void WriteData()
    {
    string str ;
    for ( int i = 0; i<=10000; i++ )
    {
    str = "Secondary Thread" + i.ToString();
    Console.WriteLine(listView1.ListItems.Count, str, 0, new string[]{""} );

    Update();
    }
    }

    Forth kill the thread

    if ( thread.IsAlive )
    {
    thread.Abort();
    }

    Another example of executing


    ValveThread = new Thread(new ThreadStart(ValveOpen));
    ValveThread.Name = "Valve";

    ValveThread.Start();

    WinnerThread = new Thread(new ThreadStart(WinnerNumbers));

    WinnerThread.Name = "Winner";

    WinnerThread.Start();

    if (cbMusic.Checked)

    {

    MusicThread = new Thread(new ThreadStart(BackgroundMusic));

    MusicThread.Name = "Music";

    MusicThread.Start();

    }

    FinalThread = new Thread(new ThreadStart(FinalNumbers));

    FinalThread.Name = "Final";

    ExitThread = new Thread(new ThreadStart(Showoff));

    ExitThread.Name = "Exit"


    3. Client & Server side in .NET based solution is really based on use of
    ASP.NET, Web Services, and understanding the .NET framework.


    I hope I answered your questions
    Share on Google+

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center