locked
How to access a database using mobile controls RRS feed

  • Question

  • User-1772197234 posted

    I have a simple project that allows me to direct the browser to a desktop or a mobile version of the website. On the desktop version, I can access an SQL Express database. Now I'm trying to repeat the functionality for the mobile side.

    I've searched alot, but can't seem to find general directions in C#, that would walk me though setting up data access.

     Would anyone be kind enough to post these steps? Many thanks,

    Saturday, October 14, 2006 2:16 AM

Answers

  • User-1772197234 posted

    Half a year later, I'll abandon this question here. No replies.

    It seems I could find answers if I was to pay a hundred dollars for a technical support call, but other than that, there are times when you just don't get assistance with microsoft products. Sometimes I find their documentation extremely frustrating - like when you are faced with gigantic amounts of unrelated information to sift through, or when they refer you to public forums where there is no body who is responsible for answering. They've created a market for paid training I suppose, but I imagine that customer support values are being done a disservice. Imagine how Microsoft's image would improve, and how much more programming creativity would emerge, if they were to devote resources to better manuals, tutorials, and more reasonably priced technical support.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 10, 2007 1:16 PM
  • User-1179442337 posted

    hi there, you can access database from yr code behind page using normal ado.net.

     ado.net is a middle layer between yr application and the database.

     

    1    public void ReadMyData(string myConnString) 
    2    {
    3       string mySelectQuery = "SELECT OrderID, Customer FROM Orders";
    4       SqlConnection myConnection = new SqlConnection(myConnString);
    5       SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
    6       myConnection.Open();
    7       SqlDataReader myReader = myCommand.ExecuteReader();
    8       try 
    9       {
    10        while (myReader.Read()) 
    11        {
    12          Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
    13        }
    14       }
    15       finally 
    16       {
    17       // always call Close when done reading.
    18       myReader.Close();
    19       // always call Close when done reading.
    20       myConnection.Close();
    21       }
    22    }
    23   
    
     

    i pasted that code from msdn site.

    you can also use datasets, by making yr own, using code. i hope maby yr getting the idea on this.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 14, 2007 1:08 PM
  • User731069546 posted

    Half a year later, I'll abandon this question here. No replies.

    I just started with ASP.NET. I am not having any problems making my ASP.NET based daatabse code work in a mobile env. The database code should remain the same whether you accessing the web site through your PC or through a mobile device. Maybe you should post more info about the problem that you are having.

    BTW - SQL mobile is only needed if you need to have database on your mobile device. It seems this is not true in your case. You already have database hooked to IIS which you accessing through a mobiel device.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 15, 2007 3:51 PM

All replies

  • User-1772197234 posted

    Further to the question, I see there is a "SQL mobile" application, but my understanding is that this runs with  a separate database on the mobile device or server.

    What I want is to use IIS (internet information services) on the web server, to communicate with an SQL EXPRESS database on the webserver. I'd just use the mobile to view the dataset running on the server. Is this possible?

     If I set up a mobile page, I have no access to sqldatasource, so there seems no way to set this up. Still this seems so basic, I'm guessing that it must be possible.

     

    Monday, October 23, 2006 1:11 AM
  • User-1772197234 posted

    Half a year later, I'll abandon this question here. No replies.

    It seems I could find answers if I was to pay a hundred dollars for a technical support call, but other than that, there are times when you just don't get assistance with microsoft products. Sometimes I find their documentation extremely frustrating - like when you are faced with gigantic amounts of unrelated information to sift through, or when they refer you to public forums where there is no body who is responsible for answering. They've created a market for paid training I suppose, but I imagine that customer support values are being done a disservice. Imagine how Microsoft's image would improve, and how much more programming creativity would emerge, if they were to devote resources to better manuals, tutorials, and more reasonably priced technical support.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 10, 2007 1:16 PM
  • User-1179442337 posted

    hi there, you can access database from yr code behind page using normal ado.net.

     ado.net is a middle layer between yr application and the database.

     

    1    public void ReadMyData(string myConnString) 
    2    {
    3       string mySelectQuery = "SELECT OrderID, Customer FROM Orders";
    4       SqlConnection myConnection = new SqlConnection(myConnString);
    5       SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
    6       myConnection.Open();
    7       SqlDataReader myReader = myCommand.ExecuteReader();
    8       try 
    9       {
    10        while (myReader.Read()) 
    11        {
    12          Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
    13        }
    14       }
    15       finally 
    16       {
    17       // always call Close when done reading.
    18       myReader.Close();
    19       // always call Close when done reading.
    20       myConnection.Close();
    21       }
    22    }
    23   
    
     

    i pasted that code from msdn site.

    you can also use datasets, by making yr own, using code. i hope maby yr getting the idea on this.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 14, 2007 1:08 PM
  • User731069546 posted

    Half a year later, I'll abandon this question here. No replies.

    I just started with ASP.NET. I am not having any problems making my ASP.NET based daatabse code work in a mobile env. The database code should remain the same whether you accessing the web site through your PC or through a mobile device. Maybe you should post more info about the problem that you are having.

    BTW - SQL mobile is only needed if you need to have database on your mobile device. It seems this is not true in your case. You already have database hooked to IIS which you accessing through a mobiel device.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 15, 2007 3:51 PM
  • User-1772197234 posted
    Thanks for the two responses. Very helpful.
    Saturday, March 17, 2007 12:18 AM