In Classic ASP it looked like...

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
 
S

shalafi

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.
 
K

Kevin Spencer

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.
 
A

Andy Sutorius

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top