473,320 Members | 1,883 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,320 software developers and data experts.

Make detail page with images (based on categoryID)

I need to make a page that shows the "top 1" article in a spesific category,
with pictures stored in another table. If I just should display the article,
I would use a datareader and bind title, ingress and body to labels.

This is how I bind the article to the labels:

Private Sub article()
Dim SQL As String = "select top 1 artID,title,ingress,body from
tblArticle where catID=@catID"
Dim conn As New SqlConnection(variables.connString)
Dim cmd As New SqlCommand(SQL, conn)
Dim parameter As New SqlParameter("@catID",
request.querystring("catID"))
cmd.Parameters.Add(parameter)

cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
While dr.Read
Me.lblTitle.Text = dr.Item("title")
Me.lblIngress.Text = Replace(dr.Item("ingress"), Chr(13),
"<br>")
Me.lblBody.Text = Replace(dr.Item("body"), Chr(13), "<br>")
End While
cmd.Connection.Close()

cmd.Dispose()
conn.Dispose()
End Sub
My question comes when I shall get the images to this article, and bind them
to a Repeater.
Can I do this in the same procedure (when I bind title, ingress and body to
the labels), or should I make a new procedure to get the images? How do I
get the articleID from the first procedure, I need this to get the correct
images...
This is how I bind the images to the repeater, but I DONT have the article
ID (inputArtID):

Private Sub images(ByVal inputArtID)
Dim SQL As String = "select path from tblImage where artID=@artID"
Dim conn As New SqlConnection(variables.connString)
Dim cmd As New SqlCommand(SQL, conn)
Dim parameter As New SqlParameter("@artID", inputArtID)
cmd.Parameters.Add(parameter)

cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
Me.rptImages.DataSource = dr
Me.rptImages.DataBind()
cmd.Connection.Close()

cmd.Dispose()
conn.Dispose()
End Sub

How do I get the article ID(artID) from the article Procedure and use this
in the images Procedure???
Dec 31 '05 #1
0 1093

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

Similar topics

8
by: Raphael Gluck | last post by:
Hi Everyone I am having some problems with a master detail page i have set up to catalogue brochures from my site. On my master page www.tripakltd.com/brochures.asp users are invited to select...
67
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod...
3
by: Joey | last post by:
Hi, I'm trying to add a default item to my listbox but when I do it tells me that it's not defined, could someone tell me the syntax I need to use to get the listbox control to display a default...
6
by: Beren | last post by:
Hi all I'm almost braindead on this one, but how can I create a master/detail datagrid in this format : CatA subcatA1 subcatA2 subcatA3
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
4
by: Jon Paal | last post by:
need help trying to associate master/detail in ASP.net 2.0 with VWD2k5EE Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)...
11
by: Daniel Seipel | last post by:
I'm new at ASP and I'm trying to query an MS SQL database (Northwind). I want the page to be setup with a textbox where the user inputs a list of comma separated numbers and the query would be...
7
by: mosipenko | last post by:
I have a website that has articles and images. The articles are stored in one table, and if they have an image associated with them, it's stored in another table with a common id linking them. I...
1
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.