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
What would you do to remove microsoft visual basic name space?
Explain the services provided by common language infrastructure.
What is misl code?
Explain the difference between datatable and dataset?
How to send xml file on server using http protocol?
What is the difference between vb 6 and vb.net?
What are the shared variables?
How can we store decimal data in .net?
Explain cls?
how to deploy vb.net with key and evaluation time? any one can help me?
Explain about visual basic?
what is interface and when it is used?
What are the objects in asp.net?
What are the differences between c# and visual basic.net?
What are all the parts of .net framework?