Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 asp.net help

Author  Topic 

Fu
Starting Member

23 Posts

Posted - 2005-11-01 : 09:15:18
<script runat="server">
Sub page_load(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
Dim oconn As New OleDbConnection("provider=sqloledb;datasource=dr;initial catalog=bm;user id=admin;password=*************")
Dim oda As OleDbDataAdapter
Dim ods As New DataSet
oconn.Open()
oda = New OleDbDataAdapter("select CDTitle as CD,CDType as Section, CDCover,shelf as Shelf from cd,shelf where cd.shelfid=shelf.shelfid", oconn)
oda.Fill(ods, " X")
dgbands.datasource = ods
dgbands.databind()
ods.Dispose()
oda.Dispose()
oconn.Close()
End If
End Sub

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataGrid ID=dgbands runat=server BorderColor=ActiveCaptionText BorderWidth=2 GridLines=Both Font-Names="arial" CellPadding=5 CellSpacing=0 HeaderStyle-BackColor=DarkSeaGreen Caption="The Following CDs Were Found"></asp:DataGrid>
</div>
</form>
</body>
</html>
--------------------------------------------------------------
when i execute this code i only get this
--------------------------------------------------------------
The Following CDs Were Found
---------------------------------
CD-----------------Section----------Shelf
--------------------------------------------------------------
Addicted To Music---------Electronica----------ABCDE
Near Eastern Lounge-------Electronica----------KLMNO
Electica------------------House----------------PQRST
---------------------------------------------------------------
sorry if it sounded stupid but i am new to asp.net any clues on how to get the cover showing too . o btw in the cdcover is an image type

jhermiz

3564 Posts

Posted - 2005-11-01 : 16:01:28
[Office Space]
Ya....ya.........you're gonna have to like pick up a SEQQQQEEELLLLLLLL book and learn T-SQL.....yaaaaaaaa...
Have you heard of JOINS yaaaaaaaaaa...
[/Office Space]

No seriously we need more info, also if it's an image type field you should be storing the path to the image. The image should be on some sort of storage such as a shared network drive and you simply point to that location. It also saves a lot of space on the database backend. Then you can use any sort of img hyperlink or a container to store that image.

Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

Fu
Starting Member

23 Posts

Posted - 2005-11-02 : 15:36:56
the image link is being inserted for every cover<< i should return images from hard drive and not from using the database?
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2005-11-02 : 17:29:35
Yes. Working with Files in the database isn't very easy, but working with the files from the OS and a path to the files in the DB is super easy.

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>
Go to Top of Page
   

- Advertisement -