Hello every body...

I'm a university student and have got a senior project by asp.net.
Actually I'm looking for a help.One of the forms I have to insert photos into sqlserver
but i don't know how to do it.
Can it be done by gridview????
.
.
In addition, I have search online for many codes...and i have found many but i don't know how to use them.

.
.
Hope to get somebody for rescue me and teach me a step by step doing my job

:)

Hello every body...

I'm a university student and have got a senior project by asp.net.
Actually I'm looking for a help.One of the forms I have to insert photos into sqlserver
but i don't know how to do it.
Can it be done by gridview????
.
.
In addition, I have search online for many codes...and i have found many but i don't know how to use them.

.
.
Hope to get somebody for rescue me and teach me a step by step doing my job

:)

it seems that no body would like to help me :'(

It is treated as any other data. Just after you upload the image to your server, you save it into a database with a regular SQL command like:

cmdInsert = New SqlCommand("INSERT INTO Images (ImageID, Image) VALUES (@ImageID, @Image)", conName)
cmdInsert.Parameters.AddWithValue("@ImageID", randomidOrWhatever )
cmdInsert.Parameters.AddWithValue("@Image", image)
conName.Open()
cmdInsert.ExecuteNonQuery()
conName.Close()

And if you're using OleDB then use 'New OleDBCommand' or if you're using ODBC, use 'OdbcCommand'. If not using MS SQL, then trade out the @ for ? like the following:
"Insert INTO Images(ImageID, Image) VALUES (?, ?)"
cmdInsert.Parameters.AddWithValue("?ImageID", randomidOrWhatever)...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.