Display data from database

Posted on 2005-05-09
Last Modified: 2010-04-07
Hi ... I'm new to and I'm trying to create an extra page for an existing application.
The page is supposed to retrieve some information form a database and display it!

I have the following!
<!-- #include file = "../scripts/include/FBrender.aspx" -->
<asp:Label ID="VraagID" runat="server" visible="False"></asp:Label><br>
<asp:Label ID="CaseID" runat="server" visible="False"></asp:Label><br>

      <asp:Label ID="FeedBack" runat="server"></asp:Label>

<%@ Page Language="VB" %>
<%@ import Namespace="System.Drawing" %>
<script runat="server">
Public connectionstring As String = System.Configuration.ConfigurationSettings.AppSettings("connectionstring")

Sub Page_Load
  Dim QuestionID = VraagID.text
  Dim intCaseID = CaseID.text
  Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)

  Dim StrSql As String = "SELECT Feedback FROM RI_CaseA WHERE Case_ID = '"& intCaseID &"' AND VraagID = '"& QuestionID &"' ORDER BY AntwoordVolgorde"
  Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(StrSql, sqlConnection)

  Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)

  if dataReader.Read then
    FeedBack.text = dataReader("Feedback")
  End if
  dataReader = Nothing

end sub

The SQL-statement
[SELECT Feedback
WHERE Case_ID = '"& intCaseID &"' AND VraagID = '"& QuestionID &"'
ORDER BY AntwoordVolgorde]
retrieves several records and I have to display them all.
I use following syntax to call the page

I'm probably forgetting something really simple!!

Thnx in advance
Question by:seloh
    LVL 52

    Expert Comment

    by:Carl Tawn
    You haven't said what the problem is !! Are you getting an error ? Or is it simply not showing anything ?
    LVL 2

    Author Comment

    There's nothing showing up ... I get an empty page!
    LVL 37

    Expert Comment

    Are you going to use the FBrender.aspx code on other pages? Wondering why you separated the pages.
    Have you tried putting the FBrender.aspx code on the same page as Feedback.aspx? Does it pull data then?

    Dont see the System.Data.SQLClient namespace reference anywhere could be that.
    You dimmed your datareader and called the namespace, but it isn't in the page directive.

    Include files are getting pretty much obsolete in .NET also...if you're practicing good OOP, then SQL and datasets should be in a separate class file or even separate project that gets referenced in your interface project.

    If you're moving from ASP to ASP.Net, I would suggest moving to Visual Studio.Net as well.

    I hate to say it...but Microsoft VS.Net is the best .Net tool.... .Net is fairly different from ASP and although you can use different IDE's and notepad for ASP, you're making it a lot harder on yourself not using VS.Net.

    Plus right now, VS.Net 2005 is in beta2 with a "Go Live" guarantee from MS.  And it is free to order the full app on DVD.  Also, the express version is free for download.

    LVL 52

    Accepted Solution

    You also don't appear to have set up databinding anywhere. You have a call to Page.DataBind, but you aren't actually binding your dataset to a control (like a datagrid for example).

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now