9 Years
Discussion Span
Last Post by dakarai.mlambo.7

Check this thread

Next time try searching the forum's before posting your queries. :)

hello boss,Only after rigrously searching for long time-i posted on this forum...
hello boss,first try to answer the queries(don't copy&paste 4m some others post)...

Votes + Comments
have some respect for those who help you.

Hello boss, did you check the link?

hello boss, i wasn't copying and pasting the code.(:D). I am just guiding you to the thread which already existed. looks like you haven't even taken a bit of an effort to search it in this forum.


hai veena,

I tried even that also-it gives an error& now im trying this stuff-but gives an error called-"unauthorisedAccess Exception was unhandled by user code"
And below is m code for button1_click(to save image )

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As String = ConfigurationSettings.AppSettings("preeconn1")
Dim str As String = "select * from table2"
Dim da As New SqlDataAdapter(str, con)
Dim cmd As New SqlCommand(str, New SqlConnection(con))
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "table2")
Dim fs As New FileStream("c:/pic/imgad[2].jpg", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
ds.Tables("table2").Rows(0)("logo") = MyData
da.Update(ds, "table2")
fs = Nothing
MyCB = Nothing
ds = Nothing
da = Nothing
con = Nothing
Response.Write("File saved to database")
End Sub

Votes + Comments
Use code tags!

Do you want it in Asp.net or Windows application?

Check the link that i posted and check the last post. I have attached a sample application. All you have to do is change the connection string to the Sql Server and it should work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.