hello
dear friends my problem is that i want to save images that
is pictures in SQL server using vb.net can any body help me
to do so please

Answer Posted / govind

step1) place one fileUpload control from tool box
step2) in it's Button click event
If FileUpload1.PostedFile Is Nothing Then
Response.Write("no file posted")

Else
Here Convert that image as byte and pass it
to function.
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim ds As New DataSet

con = New
SqlConnection(ConfigurationManager.AppSettings("connectionString"))
cmd = New SqlCommand("insert into tablename
values(@image_in), con)
Dim imageByte(FileUpload1.PostedFile.InputStream.Length) As
Byte

FileUpload1.PostedFile.InputStream.Read(imageByte, 0,
imageByte.Length)
cmd.Parameters.AddWithValue("@image_in",
imageByte)
con.Open()
cmd.ExecuteNonQuery()
con.Close()

Response.Write("file is inserted")
End If

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Observations between vb.net and vc#.net?

569


What is code security?

526


What is the source code for display the picture in button click event?

706


Allowed program to auto-correct the database when loading a presentation.

1743


Explain strong name in .net assembly?

527






Explain the difference between datatable and dataset?

552


What is static member?

578


What does assert() method do In VB.NET

530


What are all the parts of .net framework?

523


Explain about the feature anonymous type?

617


What is the difference between datagrid and gridview?

513


What is sealed class?

603


What is the strong name in .net assembly?

566


What is DLL HELL in VB.NET

612


Explain managed code?

530