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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 post picture in webpage using sql database

Author  Topic 

minstrel
Starting Member

5 Posts

Posted - 2004-10-18 : 06:58:47
Well i am new in SQL Server and i'm using VB.NET with it and i would like to know how can i post a picture (they are in a folder outside SQL - they are connected by the columns ID and fileName in database) using image.imageurl, but not putting the real name of the picture.
See below the code, please help. Thanks

Connection.Open()

SQLstring = "SELECT price, fileName FROM photos "
SQLstring &= "WHERE price = (SELECT MAX(price) FROM photos)"

Command = New SqlCommand(SQLstr, Connection)


Img_Gold.ImageUrl = Format("C:\Inetpub\wwwroot\GabPhoto\Photos\what comes next here?)

Connection.Close()

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-18 : 07:28:25
if you out it into a dataset then:
string fileName = ds.Tables[0].Rows[rowNum]["fileName"]

Img_Gold.ImageUrl = Format("C:\Inetpub\wwwroot\GabPhoto\Photos\" + fileName).

Go with the flow & have fun! Else fight the flow
Go to Top of Page

minstrel
Starting Member

5 Posts

Posted - 2004-10-18 : 07:57:05
No i don't have a dataset i have this first code following the code posted earlier.
I want to put the path when the program runs he must detect automaticly the most expensive picture and poste the picture in the Img_Gold (image webform) in the webpage.
The way you posted the code doesn't work, the image field stays with a crux in the corner of the image.
If you could help me with it i really appreciated, thanks.


Dim Connection As SqlConnection
Dim Command As SqlCommand
Dim SQLstr As String
Dim DtTb As DataTable

DtTb = Session("DtTb")

Connection = New SqlConnection("Server=localhost;uid=sa;pwd=1234;database=GabPhoto")

Conexao.Open()
Go to Top of Page
   

- Advertisement -