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



hello dear friends my problem is that i want to save images that is pictures in SQL server using..

Answer / 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

More VB.NET Interview Questions

Did vb6 support multi-threading ?

0 Answers  


I'm unable to open a .hlp file using vb.net application.

1 Answers  


How to store images in sql server database through vb.net?

0 Answers  


what do you mean by .Net Framework

17 Answers   Assurgent, College School Exams Tests, Guru Tech, Krishna Infotech, Ksb, Microsoft,


How do you do multithreading application in VB ?

4 Answers   Satyam,






What are the difference between dispose(), close(), exit(), end()?

0 Answers  


What is an indexed property?

1 Answers  


Explain how the .net framework performs automatic memory management.

0 Answers  


Tell me which namespace are used for accessing the data?

0 Answers  


Explain convert.tostring and i.tostring method?

0 Answers  


What do you mean by deserialization?

0 Answers  


What is the difference between system.applicationexception class and system.systemexception?

0 Answers  


Categories