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
Explain namespace?
What is the use of console application?
What is the significance of delegates. Where should they be used? What are the situations where we require them?
Explain about Visual basic.NET culture?
What are different types of jit ?
How does vb.net achieve polymorphism?
What is the strong name in .net assembly?
Explain i.tostring method?
Explain how to achieve polymorphism in vb.net?
How to store decimal data in .net?
What is the main use of a namespace?
What does assert() method do In VB.NET
What is vb.net used for?
What are the technology areas that microsoft.net contains?
Name some of the features of C# which are not present in VB.NET?