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

hello! I am developing software in vb6 and vb.net separately which i need to generate barcodes e.g i have a string "182346-u",so the problem is that how to generate barcode from this type of string can any body help me please thanks regard !

2 Answers  


What is the exact defination of object?

0 Answers  


What is difference between inline and code behind?

0 Answers  


What is the Difference between CLR & CTS?

3 Answers  


What is tracing?

0 Answers  






wht is the use of console application?

3 Answers   MRB,


source code for how to login a vb.net application ?

0 Answers   MCN Solutions,


How can we store decimal data in .net?

0 Answers  


What is an assembly and its use?

0 Answers  


What is the difference between convert.tostring and i.tostring method?

0 Answers  


Regarding Types of compatability in VB and their usage ?

1 Answers   Satyam,


What is multiple form in vb?

0 Answers  


Categories