473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.Net and Data access

I have developed in ASP in the past and am now getting into ASP.Net and have
hit a road block. I've been reading tutorias and documents and am still
having problems. I have the following code example:

****************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=sqlserver;database=sales;Tru sted_Connection=Yes")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
32000", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Orders")

Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="orders.aspx.vb"%>
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">

<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>

************************************************
This code looks good to me but when I run this, I do not get anything on the
page (blank). Here is the html after I run it:
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form name="_ctl0" method="post" action="orders.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw1NzE5OTAzNTI7Oz6dpCg+ix9Yj9gsw5NbtgI82h5 suw==" />

</TD>
</form>
</body>
</HTML>
I just cant understand why I am not getting any data.

Any help would be much appreciated.
Nov 19 '05 #1
13 1254
Try setting the DataSource to the Orders Table in the dataset instead of the
dataset object itself.

"Paul" wrote:
I have developed in ASP in the past and am now getting into ASP.Net and have
hit a road block. I've been reading tutorias and documents and am still
having problems. I have the following code example:

****************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=sqlserver;database=sales;Tru sted_Connection=Yes")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
32000", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Orders")

Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="orders.aspx.vb"%>
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">

<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>

************************************************
This code looks good to me but when I run this, I do not get anything on the
page (blank). Here is the html after I run it:
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form name="_ctl0" method="post" action="orders.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw1NzE5OTAzNTI7Oz6dpCg+ix9Yj9gsw5NbtgI82h5 suw==" />

</TD>
</form>
</body>
</HTML>
I just cant understand why I am not getting any data.

Any help would be much appreciated.

Nov 19 '05 #2
Is there an "orderid" field which has
an orderID value of 32000 ?

That's what you're requesting.

If a record with the value "32000" in the "orderID"
field doesn't exist, there's nothing to display.


Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
I have developed in ASP in the past and am now getting into ASP.Net and
have
hit a road block. I've been reading tutorias and documents and am still
having problems. I have the following code example:

****************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=sqlserver;database=sales;Tru sted_Connection=Yes")
MyCommand = New SqlDataAdapter("select * from orders where orderid
=
32000", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Orders")

Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="orders.aspx.vb"%>
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">

<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>

************************************************
This code looks good to me but when I run this, I do not get anything on
the
page (blank). Here is the html after I run it:
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form name="_ctl0" method="post" action="orders.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw1NzE5OTAzNTI7Oz6dpCg+ix9Yj9gsw5NbtgI82h5 suw==" />

</TD>
</form>
</body>
</HTML>
I just cant understand why I am not getting any data.

Any help would be much appreciated.

Nov 19 '05 #3
This was just an example. I was tring to retrieve some other fields also but
I still get nothing. This record does exist in the database.

"Juan T. Llibre" wrote:
Is there an "orderid" field which has
an orderID value of 32000 ?

That's what you're requesting.

If a record with the value "32000" in the "orderID"
field doesn't exist, there's nothing to display.


Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
I have developed in ASP in the past and am now getting into ASP.Net and
have
hit a road block. I've been reading tutorias and documents and am still
having problems. I have the following code example:

****************************************

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter

MyConnection = New
SqlConnection("server=sqlserver;database=sales;Tru sted_Connection=Yes")
MyCommand = New SqlDataAdapter("select * from orders where orderid
=
32000", MyConnection)

DS = New DataSet
MyCommand.Fill(DS, "Orders")

Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="orders.aspx.vb"%>
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">

<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>

************************************************
This code looks good to me but when I run this, I do not get anything on
the
page (blank). Here is the html after I run it:
<HTML>
<HEAD>
<title>orders</title>
</HEAD>
<body>
<form name="_ctl0" method="post" action="orders.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDw1NzE5OTAzNTI7Oz6dpCg+ix9Yj9gsw5NbtgI82h5 suw==" />

</TD>
</form>
</body>
</HTML>
I just cant understand why I am not getting any data.

Any help would be much appreciated.


Nov 19 '05 #4
Check your data again. I took your exact code, just changed the connection
string to the Northwind database, and the OrderID to 10270, and it all works
just fine (ie a record is returned and the ID appears on my screen).

Terri
MVP - ASP/ASP.NET

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
This was just an example. I was tring to retrieve some other fields also
but
I still get nothing. This record does exist in the database.

"Juan T. Llibre" wrote:
Is there an "orderid" field which has
an orderID value of 32000 ?

That's what you're requesting.

If a record with the value "32000" in the "orderID"
field doesn't exist, there's nothing to display.


Nov 19 '05 #5
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid = 10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========

"Terri Morton" <tm*****@macdirect.com> wrote in message news:ev**************@TK2MSFTNGP11.phx.gbl...
Check your data again. I took your exact code, just changed the connection
string to the Northwind database, and the OrderID to 10270, and it all works
just fine (ie a record is returned and the ID appears on my screen).

Terri
MVP - ASP/ASP.NET

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
This was just an example. I was tring to retrieve some other fields also
but
I still get nothing. This record does exist in the database.

"Juan T. Llibre" wrote:
Is there an "orderid" field which has
an orderID value of 32000 ?

That's what you're requesting.

If a record with the value "32000" in the "orderID"
field doesn't exist, there's nothing to display.



Nov 19 '05 #6
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to a
Time Tracker database (sample ASP.NET app download from MS) and still nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid = 10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========

"Terri Morton" <tm*****@macdirect.com> wrote in message news:ev**************@TK2MSFTNGP11.phx.gbl...
Check your data again. I took your exact code, just changed the connection
string to the Northwind database, and the OrderID to 10270, and it all works
just fine (ie a record is returned and the ID appears on my screen).

Terri
MVP - ASP/ASP.NET

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
This was just an example. I was tring to retrieve some other fields also
but
I still get nothing. This record does exist in the database.

"Juan T. Llibre" wrote:

Is there an "orderid" field which has
an orderID value of 32000 ?

That's what you're requesting.

If a record with the value "32000" in the "orderID"
field doesn't exist, there's nothing to display.


Nov 19 '05 #7
Are you recompiling your code before you try it out in the browser?

Juan's code below does not involve a code-behind file, so it would be
compiled automatically before being brought up in the browser. But the code
you originally supplied involves a code-behind file and would require
compilation.

Terri Morton
MVP - ASP/ASP.NET
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to
a
Time Tracker database (sample ASP.NET app download from MS) and still
nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated
Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========

Nov 19 '05 #8
I have run the Build option after every change and I still get nothing.

"Terri Morton" wrote:
Are you recompiling your code before you try it out in the browser?

Juan's code below does not involve a code-behind file, so it would be
compiled automatically before being brought up in the browser. But the code
you originally supplied involves a code-behind file and would require
compilation.

Terri Morton
MVP - ASP/ASP.NET
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to
a
Time Tracker database (sample ASP.NET app download from MS) and still
nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated
Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========


Nov 19 '05 #9
Do you get any error messages ?
If so, what do they say ?

Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to
a
Time Tracker database (sample ASP.NET app download from MS) and still
nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated
Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========

"Terri Morton" <tm*****@macdirect.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
> Check your data again. I took your exact code, just changed the
> connection
> string to the Northwind database, and the OrderID to 10270, and it all
> works
> just fine (ie a record is returned and the ID appears on my screen).
>
> Terri
> MVP - ASP/ASP.NET
>
> "Paul" <Pa**@discussions.microsoft.com> wrote in message
> news:6B**********************************@microsof t.com...
>> This was just an example. I was tring to retrieve some other fields
>> also
>> but
>> I still get nothing. This record does exist in the database.
>>
>> "Juan T. Llibre" wrote:
>>
>>> Is there an "orderid" field which has
>>> an orderID value of 32000 ?
>>>
>>> That's what you're requesting.
>>>
>>> If a record with the value "32000" in the "orderID"
>>> field doesn't exist, there's nothing to display.
>
>
>

Nov 19 '05 #10
For grins, can you take the exact code posted by Juan, save it as test.aspx,
put that in your web folder, try it out in your browser, and let us kow what
you see?

Terri Morton
MVP - ASP/ASP.NET

"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.com...
I have run the Build option after every change and I still get nothing.

"Terri Morton" wrote:
Are you recompiling your code before you try it out in the browser?

Juan's code below does not involve a code-behind file, so it would be
compiled automatically before being brought up in the browser. But the
code
you originally supplied involves a code-behind file and would require
compilation.

Terri Morton
MVP - ASP/ASP.NET
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
> The data is fine. The record exists. I tried pointing this code to
> the
> Northwind database also with the same result. I also tried pointing it
> to
> a
> Time Tracker database (sample ASP.NET app download from MS) and still
> nothing
> (even though the Time Tracker app works fine).
>
> Can't understand why this does not work.
>
>
>
> "Juan T. Llibre" wrote:
>
>> You beat me to that by a few minutes. :-)
>>
>> 10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
>> Torikatu 38 Oulu 90110 Finland
>>
>> There's nothing wrong with that code.
>> I did the same as you to test Paul's code.
>>
>> Here's the complete code used :
>>
>>
>> <%@ Page Language="vb" %>
>> <%@ Import Namespace="System.Data" %>
>> <%@ Import Namespace="System.Data.SqlClient" %>
>> <HTML>
>> <HEAD>
>> <title>orders</title>
>> <script language="vb" runat="server">
>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Load
>> Dim DS As DataSet
>> Dim MyConnection As SqlConnection
>> Dim MyCommand As SqlDataAdapter
>> MyConnection = New SqlConnection("Server=MySQLServer;Integrated
>> Security=True;Database=Northwind")
>> MyCommand = New SqlDataAdapter("select * from orders where orderid =
>> 10270", MyConnection)
>> DS = New DataSet
>> MyCommand.Fill(DS, "Orders")
>> Repeater2.DataSource = DS
>> Repeater2.DataBind()
>> End Sub
>> </script>
>> </HEAD>
>> <body>
>> <form id="Form1" runat="server">
>> <asp:Repeater id="Repeater2" runat="server">
>> <HeaderTemplate>
>> <Table width="100%" style="font: 8pt verdana">
>> <tr>
>> <th>
>> Order ID
>> </th>
>> </tr>
>> </HeaderTemplate>
>> <ItemTemplate>
>> <tr>
>> <td>
>> <%# DataBinder.Eval(Container.DataItem, "OrderID") %>
>> </td>
>> </tr>
>> </ItemTemplate>
>> <FooterTemplate>
>> </table>
>> </FooterTemplate>
>> </asp:Repeater></TD>
>> </form>
>> </body>
>> </HTML>
>>
>>
>>
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> ===========

Nov 19 '05 #11
I get nothing. A blank page is displayed. Build succeeds without errors also.

"Juan T. Llibre" wrote:
Do you get any error messages ?
If so, what do they say ?

Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to
a
Time Tracker database (sample ASP.NET app download from MS) and still
nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:
You beat me to that by a few minutes. :-)

10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
Torikatu 38 Oulu 90110 Finland

There's nothing wrong with that code.
I did the same as you to test Paul's code.

Here's the complete code used :
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>orders</title>
<script language="vb" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection("Server=MySQLServer;Integrated
Security=True;Database=Northwind")
MyCommand = New SqlDataAdapter("select * from orders where orderid =
10270", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Orders")
Repeater2.DataSource = DS
Repeater2.DataBind()
End Sub
</script>
</HEAD>
<body>
<form id="Form1" runat="server">
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr>
<th>
Order ID
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container.DataItem, "OrderID") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater></TD>
</form>
</body>
</HTML>


Juan T. Llibre
ASP.NET MVP
===========

"Terri Morton" <tm*****@macdirect.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
> Check your data again. I took your exact code, just changed the
> connection
> string to the Northwind database, and the OrderID to 10270, and it all
> works
> just fine (ie a record is returned and the ID appears on my screen).
>
> Terri
> MVP - ASP/ASP.NET
>
> "Paul" <Pa**@discussions.microsoft.com> wrote in message
> news:6B**********************************@microsof t.com...
>> This was just an example. I was tring to retrieve some other fields
>> also
>> but
>> I still get nothing. This record does exist in the database.
>>
>> "Juan T. Llibre" wrote:
>>
>>> Is there an "orderid" field which has
>>> an orderID value of 32000 ?
>>>
>>> That's what you're requesting.
>>>
>>> If a record with the value "32000" in the "orderID"
>>> field doesn't exist, there's nothing to display.
>
>
>


Nov 19 '05 #12
There must have been an issue with the form itself. I created a new Web Form
and copied the code over and it works now.

Really weird but the issue is gone now.

Thanks to all for your input.

"Paul" wrote:
I get nothing. A blank page is displayed. Build succeeds without errors also.

"Juan T. Llibre" wrote:
Do you get any error messages ?
If so, what do they say ?

Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
The data is fine. The record exists. I tried pointing this code to the
Northwind database also with the same result. I also tried pointing it to
a
Time Tracker database (sample ASP.NET app download from MS) and still
nothing
(even though the Time Tracker app works fine).

Can't understand why this does not work.

"Juan T. Llibre" wrote:

> You beat me to that by a few minutes. :-)
>
> 10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian Herkku
> Torikatu 38 Oulu 90110 Finland
>
> There's nothing wrong with that code.
> I did the same as you to test Paul's code.
>
> Here's the complete code used :
>
>
> <%@ Page Language="vb" %>
> <%@ Import Namespace="System.Data" %>
> <%@ Import Namespace="System.Data.SqlClient" %>
> <HTML>
> <HEAD>
> <title>orders</title>
> <script language="vb" runat="server">
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim DS As DataSet
> Dim MyConnection As SqlConnection
> Dim MyCommand As SqlDataAdapter
> MyConnection = New SqlConnection("Server=MySQLServer;Integrated
> Security=True;Database=Northwind")
> MyCommand = New SqlDataAdapter("select * from orders where orderid =
> 10270", MyConnection)
> DS = New DataSet
> MyCommand.Fill(DS, "Orders")
> Repeater2.DataSource = DS
> Repeater2.DataBind()
> End Sub
> </script>
> </HEAD>
> <body>
> <form id="Form1" runat="server">
> <asp:Repeater id="Repeater2" runat="server">
> <HeaderTemplate>
> <Table width="100%" style="font: 8pt verdana">
> <tr>
> <th>
> Order ID
> </th>
> </tr>
> </HeaderTemplate>
> <ItemTemplate>
> <tr>
> <td>
> <%# DataBinder.Eval(Container.DataItem, "OrderID") %>
> </td>
> </tr>
> </ItemTemplate>
> <FooterTemplate>
> </table>
> </FooterTemplate>
> </asp:Repeater></TD>
> </form>
> </body>
> </HTML>
>
>
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
>
> "Terri Morton" <tm*****@macdirect.com> wrote in message
> news:ev**************@TK2MSFTNGP11.phx.gbl...
> > Check your data again. I took your exact code, just changed the
> > connection
> > string to the Northwind database, and the OrderID to 10270, and it all
> > works
> > just fine (ie a record is returned and the ID appears on my screen).
> >
> > Terri
> > MVP - ASP/ASP.NET
> >
> > "Paul" <Pa**@discussions.microsoft.com> wrote in message
> > news:6B**********************************@microsof t.com...
> >> This was just an example. I was tring to retrieve some other fields
> >> also
> >> but
> >> I still get nothing. This record does exist in the database.
> >>
> >> "Juan T. Llibre" wrote:
> >>
> >>> Is there an "orderid" field which has
> >>> an orderID value of 32000 ?
> >>>
> >>> That's what you're requesting.
> >>>
> >>> If a record with the value "32000" in the "orderID"
> >>> field doesn't exist, there's nothing to display.
> >
> >
> >


Nov 19 '05 #13
Whew!

Thanks for letting us know...

Juan T. Llibre
ASP.NET MVP
===========
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
There must have been an issue with the form itself. I created a new Web
Form
and copied the code over and it works now.

Really weird but the issue is gone now.

Thanks to all for your input.

"Paul" wrote:
I get nothing. A blank page is displayed. Build succeeds without errors
also.

"Juan T. Llibre" wrote:
> Do you get any error messages ?
> If so, what do they say ?
>
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
> "Paul" <Pa**@discussions.microsoft.com> wrote in message
> news:F7**********************************@microsof t.com...
> > The data is fine. The record exists. I tried pointing this code to
> > the
> > Northwind database also with the same result. I also tried pointing
> > it to
> > a
> > Time Tracker database (sample ASP.NET app download from MS) and still
> > nothing
> > (even though the Time Tracker app works fine).
> >
> > Can't understand why this does not work.
> >
> >
> >
> > "Juan T. Llibre" wrote:
> >
> >> You beat me to that by a few minutes. :-)
> >>
> >> 10270 WARTH 1 01/08/1996 29/08/1996 02/08/1996 1 136.54 Wartian
> >> Herkku
> >> Torikatu 38 Oulu 90110 Finland
> >>
> >> There's nothing wrong with that code.
> >> I did the same as you to test Paul's code.
> >>
> >> Here's the complete code used :
> >>
> >>
> >> <%@ Page Language="vb" %>
> >> <%@ Import Namespace="System.Data" %>
> >> <%@ Import Namespace="System.Data.SqlClient" %>
> >> <HTML>
> >> <HEAD>
> >> <title>orders</title>
> >> <script language="vb" runat="server">
> >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> >> System.EventArgs) Handles MyBase.Load
> >> Dim DS As DataSet
> >> Dim MyConnection As SqlConnection
> >> Dim MyCommand As SqlDataAdapter
> >> MyConnection = New SqlConnection("Server=MySQLServer;Integrated
> >> Security=True;Database=Northwind")
> >> MyCommand = New SqlDataAdapter("select * from orders where orderid =
> >> 10270", MyConnection)
> >> DS = New DataSet
> >> MyCommand.Fill(DS, "Orders")
> >> Repeater2.DataSource = DS
> >> Repeater2.DataBind()
> >> End Sub
> >> </script>
> >> </HEAD>
> >> <body>
> >> <form id="Form1" runat="server">
> >> <asp:Repeater id="Repeater2" runat="server">
> >> <HeaderTemplate>
> >> <Table width="100%" style="font: 8pt verdana">
> >> <tr>
> >> <th>
> >> Order ID
> >> </th>
> >> </tr>
> >> </HeaderTemplate>
> >> <ItemTemplate>
> >> <tr>
> >> <td>
> >> <%# DataBinder.Eval(Container.DataItem, "OrderID") %>
> >> </td>
> >> </tr>
> >> </ItemTemplate>
> >> <FooterTemplate>
> >> </table>
> >> </FooterTemplate>
> >> </asp:Repeater></TD>
> >> </form>
> >> </body>
> >> </HTML>
> >>
> >>
> >>
> >>
> >> Juan T. Llibre
> >> ASP.NET MVP
> >> ===========
> >>
> >> "Terri Morton" <tm*****@macdirect.com> wrote in message
> >> news:ev**************@TK2MSFTNGP11.phx.gbl...
> >> > Check your data again. I took your exact code, just changed the
> >> > connection
> >> > string to the Northwind database, and the OrderID to 10270, and it
> >> > all
> >> > works
> >> > just fine (ie a record is returned and the ID appears on my
> >> > screen).
> >> >
> >> > Terri
> >> > MVP - ASP/ASP.NET
> >> >
> >> > "Paul" <Pa**@discussions.microsoft.com> wrote in message
> >> > news:6B**********************************@microsof t.com...
> >> >> This was just an example. I was tring to retrieve some other
> >> >> fields
> >> >> also
> >> >> but
> >> >> I still get nothing. This record does exist in the database.
> >> >>
> >> >> "Juan T. Llibre" wrote:
> >> >>
> >> >>> Is there an "orderid" field which has
> >> >>> an orderID value of 32000 ?
> >> >>>
> >> >>> That's what you're requesting.
> >> >>>
> >> >>> If a record with the value "32000" in the "orderID"
> >> >>> field doesn't exist, there's nothing to display.
> >> >
> >> >
> >> >
>
>
>

Nov 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
9
by: Tony Lee | last post by:
Some time a ago, on this newsgroup the following comments were made in recommending good references for Access (2003) >I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.