user1336656
user1336656

Reputation: 13

How to store image to sql database using Data Access Layer (asp.net)

I have a Data Access Layer

public void AddPartyAsIndividual(AddAnIndividual Student)
{
    using (SqlConnection con = new SqlConnection(ConnString))
    {
        SqlCommand cmd = new SqlCommand("AddIndividualParty", con);
        cmd.CommandType = CommandType.StoredProcedure;

        md.Parameters.AddWithValue("@Student_Image", STudent.StudentImage);

        if (con.State == ConnectionState.Closed)
        {
            con.Open();
            cmd.ExecuteNonQuery();
        }
    }

Upvotes: 0

Views: 692

Answers (1)

Joshua H
Joshua H

Reputation: 839

Take a look at the following Codeproject article. It demonstrates how to store and retrieve images via SQL Server. The example used is a Winforms client, but the code can be adapted to any project type.

Storing and Retrieving Images from SQL Server Using Strored Procedures and C#.net

Upvotes: 1

Related Questions