locked
SQL Connection only works after browsing internet RRS feed

  • Question

  • For a C# Form on a windows mobile device.

    Hi, my SQL connection works fine when cradled and works fine when not cradled as long as I go to the web browser and load up a website first.

    private
     SqlConnection thisConnection = Global.thisConnection;<br/>        private
     System.Data.DataTable Select(string
     SQL)
    {<br/> DBHLocal dbhl = new DBHLocal();
    System.Data.DataTable DT = new System.Data.DataTable();
    try
    {
    thisConnection.Close();
    thisConnection.Open();
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(SQL, thisConnection);
    adapter.Fill(DT);
    thisConnection.Close();
    return DT;
    }
    Is there a special way I am meant to connect first without loading a web page in a web browser?

    Thanks in advance.
    • Edited by Bonzol Wednesday, December 16, 2009 5:08 AM
    Wednesday, December 16, 2009 4:54 AM

Answers

  • Sounds like you need to make use of the Connection manager to ensure that the needed connection is available before doing your work.
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    • Marked as answer by warrentang Tuesday, December 22, 2009 9:24 AM
    Wednesday, December 16, 2009 8:55 PM

All replies

  • Hi Bonzol,

    First of all your question is not much cleared.

    If you are talking about ASP.NET (Web Application) in WM then you must ask this question here http://forums.asp.net/



    Hope this may be help.

    If you find my post is helpful for you then mark as a answer.
    Wednesday, December 16, 2009 5:05 AM
  • Sorry, it is for a C# windows form app on a windows mobile device!
    Wednesday, December 16, 2009 5:08 AM
  • Sounds like you need to make use of the Connection manager to ensure that the needed connection is available before doing your work.
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    • Marked as answer by warrentang Tuesday, December 22, 2009 9:24 AM
    Wednesday, December 16, 2009 8:55 PM