Results 1 to 2 of 2

Thread: Need a little ASP.NET help

  1. #1

    Thread Starter
    Lively Member Nator's Avatar
    Join Date
    Nov 1999
    Location
    East Larryville, GA
    Posts
    80

    Need a little ASP.NET help

    I have just started learning ASP.NET. So far I have not been very successful regarding database work. Every tutorial I have seen wants to push bound recordsets. Up until now, I have used disconnected recordsets almost exclusively. Can you use the old style ADO disconnected recordsets? For example, how would something like

    <%@ Language="VBScript" %>
    <html>
    <body>
    <%
    sConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=northwind;Data Source=(local)"

    set rst = Server.CreateObject("ADODB.Recordset")
    rst.open "SELECT (lastname + ', ' + firstname) as Empname FROM employees", sConn

    while not rst.eof %>
    <SELECT id=select1 size=2 name=select1>
    <OPTION><% = rst.Fields("empname") %>
    </OPTION>
    <% rst.movenext
    wend
    set rst = nothing
    %>
    </SELECT>
    </BODY>
    </html>

    look like in ASP.NET? Seems like the .NET tutorials use a lot of code to do basic data retrieval that ASP 3.0 did in a few lines of code.

  2. #2
    Lively Member
    Join Date
    Aug 1999
    Location
    Amsterdam
    Posts
    117
    Recordsets don't exist anymore, the thing closest to Recordsets are DataTables. The idea behind ADO.NET is that everything always is disconnected. You actually still can work in a connected way by explicitly opening and closing connections.

    Data binding is being pussed in may tutorials because it covers many scenarios and is a lot faster in development.

    In ASP.NET you don't need much more code, and the code you're writing is a lot cleaner than with good old ASP (spaghetti code like your sample code above).

    Just take a look at a good ADO/ASP.NET tutorial and you'll discover the power of both.
    Last edited by gijsj; Dec 10th, 2001 at 08:35 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width