ASP or ASPX thats the question!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ASP or ASPX thats the question!

  1. #1
    Frank Freeman Guest

    ASP or ASPX thats the question!

    When should I use an aspx file. Should it be only for webForms or can I just
    use it instead of normal ASP?

    I am a bit confused. I try to connect to a database, run a query and show
    some records.
    It all works fine using ASP. But for the practice sake I would like to use a
    webform. I can make it work if use DT controls to connect to SQL server via
    ADO.net. Is it the only way?

    I can also make it work when I put all my code in aspx. But as far as I
    understand its not the way to do it. The server side code is suppose to go
    in a .vb or .cs file and aspx is for (D)HTML code.

    here is short example of what I would like to see converted to asp.net

    <%
    ' ----------------------------
    Set cnnString = Server.CreateObject("ADODB.Connection")

    cnnString.Open
    "Provider=SQLOLEDB;SERVER=server1;DATABASE=test1;UID=sa;PWD="'

    rstString = cnnString.Execute("SELECT name FROM table")

    ' Get all records
    strDBData = rstString.GetString()

    Response.write strDBData
    '--------------------------------
    %>


    thanks
    Frank



  2. #2
    Jamster Guest

    Re: ASP or ASPX thats the question!


    You might want to start using the server explorer so it will automatically
    create the connections and bindings for you...It becomes alot easier as well
    when your using winform components to referenc data.....




    "Frank Freeman" <mptsm@hotmail.com> wrote:
    >When should I use an aspx file. Should it be only for webForms or can I

    just
    >use it instead of normal ASP?
    >
    >I am a bit confused. I try to connect to a database, run a query and show
    >some records.
    >It all works fine using ASP. But for the practice sake I would like to use

    a
    >webform. I can make it work if use DT controls to connect to SQL server

    via
    >ADO.net. Is it the only way?
    >
    >I can also make it work when I put all my code in aspx. But as far as I
    >understand its not the way to do it. The server side code is suppose to

    go
    >in a .vb or .cs file and aspx is for (D)HTML code.
    >
    > here is short example of what I would like to see converted to asp.net
    >
    ><%
    >' ----------------------------
    >Set cnnString = Server.CreateObject("ADODB.Connection")
    >
    >cnnString.Open
    >"Provider=SQLOLEDB;SERVER=server1;DATABASE=test1;UID=sa;PWD="'
    >
    >rstString = cnnString.Execute("SELECT name FROM table")
    >
    >' Get all records
    >strDBData = rstString.GetString()
    >
    >Response.write strDBData
    >'--------------------------------
    >%>
    >
    >
    >thanks
    >Frank
    >
    >



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