473,802 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDataAdapter & Label

One of the columns in a SQL Server 2005 DB table is named 'OrderDate'
which stores the date & time on which an order has been placed. Since
the 'OrderDate' of a particular order will be the same, I want to
display the 'OrderDate' in a Label control & the rest of the records
should be displayed in a DataList. This is how I approached it:

<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim dSet As DataSet
Dim sqlConn As SqlConnection
Dim sqlDapter As SqlDataAdapter

sqlConn = New SqlConnection(" .....")
sqlDapter = New SqlDataAdapter( "SELECT * FROM Orders WHERE
OrderID=6", sqlConn)

dSet = New DataSet()
sqlDapter.Fill( dSet, "Orders")

DataListOrder.D ataSource = dSet.Tables("Or ders").DefaultV iew
DataListOrder.D ataBind()
End Sub
</script>

<form runat="server">
<asp:Label ID="lblOrderDat e" runat="server"/>

<asp:DataList ID="DataListOrd er" runat="server">
<HeaderTemplate >
<table border=2>
.......
</HeaderTemplate>
<ItemTemplate >
<tr>
<td><%# Container.DataI tem("ProductNam e") %></td>
<td><%# Container.DataI tem("Category") %></td>
<td><%# Container.DataI tem("Price") %></td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:DataList>
</form>

The records under the columns 'ProductName', 'Category' & 'Price' in
the DB table will get looped automatically & will get displayed in the
DataList but how do I display the 'OrderDate' corresponding to
OrderID=6 in the Label control?

Nov 16 '06 #1
0 1189

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

Similar topics

2
1805
by: Louise GK | last post by:
Hi there. I've written a simple program that makes a simple GET form with a text input box and displays $_GET when submitted. Using Windows Character Map, I pasted in the Cyrillic capital "Ya" (the backward R) and it came out as "Я". So far so good. Then I sent in " Я" (The is the Cyrillic character again.) That came out as "Я Я". How can I please tell the difference between the Cyrillic and the character sequence '&', '#',
0
1910
by: zhaoJian | last post by:
Here it is my code ,but it can't update the database.How to do it ? In _UpdateUnit event, I can not get the original value to @Original_UnitID,so I set a hidden column named LabelKey.But It don't update the database.My server is SqlServer 2000. using System; using System.Collections;
2
1707
by: Jim in Arizona | last post by:
Being new, i experiment a lot and usually get results I'm not hoping for. My current problem is reading from a SQL 2000 table and populating an ASP dropdownlist with a column from the table. The only thing displayed in the DropDownList is: System.Data.Common.DbDataRecord So, under the Page_Load Event, here's my code: Dim strSQL, strConnection As String
1
2740
by: Ranny | last post by:
Question: What is the process to Insert a record using Dataset and SQLDataAdapter? Explanation: Thanks to Cor I am able to get a record to load, modify it, and save it to the database. My current problem is one of my fields is NOT NULL and a primary key. I want to be able to open the form with the fields blank (new record). My current thinking is: 'Create the SQL Connection, DataAdapter, and DataSet mySQLConnection = New...
0
2229
by: BigAl.NZ | last post by:
Hi Guys, I am trying to write/copy some code that uses events with a GPS. Everytime the GPS position updates the event fires. The GPS code is from a SDK Library that I got called GPS Tools from www.franson.com For some reason my code below doesnt work - the GpsFixEvent never seems to "fire" as it were.
3
1633
by: Jeff | last post by:
Hey! ASP.NET 2.0 I have a webpage which is based on a nested master page. The problem is that I've applied a theme to the webpage but the CSS settings isn't applied to the panes.... As you will see in the link, a label market "rightpane" is placed to the left. It should have been on the right, and have a different color.
0
851
by: Sody | last post by:
Hi, is in gridview any way how to control from codebehid if an itemtemplate in gridview will be set to visible = true / false ? here is an example of gridview with more itemtemplates <asp:GridView ID="grdTracking" runat="server" AutoGenerateColumns="False" BorderWidth="0" GridLines="Horizontal" Width="100%"> <FooterStyle /> <Columns> <asp:TemplateField HeaderText="&nbsp;"
5
2943
by: Nike1984 | last post by:
I'm fairly new to Javascript and it's more of a guessing game for me... I'm trying to build an app for Google Maps and just had some issues recently. First off I just wanted to say that everything works fine in FF and IE. It's Chrome I'm having issues with. I understand that Chrome is still somewhat in beta stages, so some bugs might occur. However this seems like something I might have done. So... I used a code that I found on Econym as...
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.