Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
Hi...

Plz help me,its urgent.

How to store images in mysql db,retrieve them ?.

thank u.


Any have, i got solution to it.
Thank u.
Posted
Updated 30-Apr-13 3:25am
v3
Comments
Oshtri Deka 29-Apr-13 5:58am    
Is this homework?

This is what Google returns.

I particularly like this result.

P.S. Do yourself a favor. Instead of waiting here for an answer you should look around first, then you should try something on your own. If you get stuck nice people here will gladly help you.
But expecting for others to do all work for you is kind of rude and lazy.

Good luck with your assignment!
 
Share this answer
 
v3
Try this !! Solved one !!

C#
protected void Button1_Click(object sender, EventArgs e)
{
    string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
    string SaveLocation = Server.MapPath("Folder name of which image is stored") + "\\" + FileName;

    try
    {

        FileUpload1.PostedFile.SaveAs(SaveLocation);

        string strQuery = "Insert Into Elevation (Field_name1, Field_name2)" + " values(@Project, @Elevation)";

        SqlCommand cmd = new SqlCommand(strQuery);

        cmd.Parameters.AddWithValue("@Field_name1", TextBox1.Text);

        cmd.Parameters.AddWithValue("@Field_name12", "Folder name/" + FileName);

        cmd.CommandType = CommandType.Text;

        cmd.Connection = Con;

        Con.Open();

        cmd.ExecuteNonQuery();

    }

    catch (Exception ex)
    {

        Response.Write("Error:" + ex.Message);

    }

    finally
    {

        Con.Close();

        Con.Dispose();

    }
}


Mark it as answer if it works !!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900