Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
krishna

Registered:
Posts: 145
Reply with quote  #1 
Hi
I have this code in button click.

Public Overrides Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs)
Try
For i As Integer = 1 To HttpContext.Current.Request.Files.Count - 1
Dim postedFile As HttpPostedFile = HttpContext.Current.Request.Files(i)
Dim filename As String = Path.GetFileName(postedFile.FileName)
Using fs As Stream = postedFile.InputStream
Using br As New BinaryReader(fs)
Dim bytes As Byte() = br.ReadBytes(Convert.ToInt32(fs.Length))
Dim constr As String = BaseClasses.Configuration.ApplicationSettings.Current.GetConnectionString ("Databaseedgetest")
Using con As New SqlConnection(constr)
Dim query As String = "insert into photos values (@ProjectID, @StoreID,@Hub,@StageofWork,@ClientCanSee,@PhotoTypeID,@Photo,@PhotoFile,@LogBy,@LogDate,@JobCardNo)"
Using cmd As New SqlCommand(query)
cmd.Connection = con
cmd.Parameters.AddWithValue("@ProjectID", 2170)
cmd.Parameters.AddWithValue("@StoreID", 7079)
cmd.Parameters.AddWithValue("@PhotoTypeID", 2)
cmd.Parameters.AddWithValue("@Photo", bytes)
cmd.Parameters.AddWithValue("@PhotoFile",filename)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
End Using
End Using
Next
Catch ex As Exception
Me.Page.ErrorOnPage = True
' Report the error message to the end user
Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message)
Finally
End Try
End Sub

I also have overridden getuidata to reduce image size.
But no reduction is happening when image is saved into the database.
My query is, how to call or effect the getuidata method within the button click?
Please advise.

thanks
Krishna


Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement