Last post Mar 10, 2013 01:05 PM by adaam2
Mar 09, 2013 04:10 PM|adaam2|LINK
I have a list page which displays thumbnails of various books + their details within a GridView, and I have a detail page which displays the full sized version of the same image. I also have an add to database page called addbook.aspx. Here is the code behind
Public Class addBook
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Protected Sub btn_submission_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_submission.Click
Dim myGUID = Guid.NewGuid()
Dim newFileName As String = myGUID.ToString() & ".jpg"
Dim fileLocationOnServerHardDisk = Request.MapPath("img") & "/" & newFileName
Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("BookMeetConnString").ConnectionString)
Dim SqlString As String = "Insert into booklist(Title,Author,PublicationDate,Pages,Publisher,imgurl,AverageRating) Values (@f1,@f2,@f3,@f4,@f5,@f6,@f7)"
Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("@f6", "img/" & newFileName)
The code above works absolutely fine, but i would like to modify it so it also produces thumbnail images as well as writing to the database, as well as cater for more than .jpg images.
How do I acheive this (can it be done in the code behind or do I need to add some sort of package to the solution?)
EDIT: I am using accdb database, the table is called hotellist as you can see above and the table has both imageurl fields (i.e. full size image urls) and thumburl field (thumbnail image urls - i have already added some thumbnails manually from within access)
Mar 09, 2013 06:56 PM|ammd|LINK
As this question has been asked a few times have a look at:
how this helps.
Mar 10, 2013 01:05 PM|adaam2|LINK
Thank you very much.