Click here to Skip to main content
14,635,966 members
Rate this:
Please Sign up or sign in to vote.
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?
Rate this:
Please Sign up or sign in to vote.

Solution 1

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!
   
v3
Rate this:
Please Sign up or sign in to vote.

Solution 3

Try this !! Solved one !!

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 !!
   
v2

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100