In Classic ASP it looked like...

  • Thread starter Thread starter Andy Sutorius
  • Start date Start date
A

Andy Sutorius

In classic asp you can get at data from a db like this:

I am <%=rs("height")%> feet tall

How can this be accomplished in ASP.NET? What does the ADO.NET need to look
like? Can it be done without "binding" to a datagrid, etc.?

Thanks

Andy
 
quick 'n dirty way would be to have

I am <asp:label id="txtHeight"></asp:label> feet tall
in the aspx file

and do something like
txtHeight.text = DS["Height"].toString();
in the codebehind.

cannot use the <% %> tags as much as you did in classic asp. it's good and
bad. Webclasses caused MAJOR overhead when rescanning proposed output when
the pages got big, asp.net suffers a penalty too but not as bad.
 
There are no good shortcuts, Andy. You need to study up on the
object-oriented programming model of ASP.Net, which work in a much different
way than the procedural Classic ASP programming model. While it is painful
in the short run to understand, at some point it "clicks" and all falls into
place. At that point, you'll never want to touch Classic ASP again. The .Net
SDK is a free download from:

http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

It has numerous tutorials, articles, and sample code, as well as an awesome
reference of the entire .Net Common Language Runtime library (CLR).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
The end result looks like this in the code behind:

conNewConn.open()
cmdGetMaxJuri = New OleDbCommand("select max(juri)+1 As
newjuri from juri", conNewConn)
lblMaxJuri.Text = cmdGetMaxJuri.ExecuteScalar()
conNewConn.close()

The end result looks like this in the presentation:

<asp:Label id="lblMaxJuri" runat="server"></asp:Label>
 
Back
Top