Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Can you please explain the difference between dispose and finalize()?

1067


thak you Mr Govind for replying to my question. My next question is that how to retrieve image stored in an SQL server table and assign it to any image control or picture control using VB.net

2110


What is late binding?

955


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

907


What are all the differences between dispose and finalize()?

1104


What is strong name in .net assembly?

987


What is globalization?

992


What is the diff between vb mdi form and .net mdi form?

1013


Can you please explain the difference between int and int32?

1088


How do you call a stored procedure in Visual Basic?

1169


Write a program to find all text files in a logical drive and return the count of the number of files?

2721


Name the two main parts of .net?

951


What is the difference between c# and vb.net?

1015


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

1163


How does vb.net achieve polymorphism?

947