tags:

views:

49

answers:

1

i can add images without any problem to my website.with my below code..i am using linq and asp.net with c#....

ImageDatabaseDataContext imdb = new ImageDatabaseDataContext();
Dosyalar ds;
Katilimci kt;
protected void btnEkle_Click(object sender, EventArgs e)
{
    if (FileUpload1.FileContent != null)
    {
        string dosyaAdi = Guid.NewGuid().ToString();
        byte[] icerik = FileUpload1.FileBytes;
        string dosyaTipi = FileUpload1.PostedFile.ContentType;

        try
        {
            ds = new Dosyalar();
            kt = new Katilimci();
            kt.AdSoyad = txtAdSoyad.Text;
            kt.BolgeMudurlugu = txtBolgeMudurlugu.Text;
            kt.Gorevi = txtGorev.Text;
            kt.NoktaAd = txtNoktaAd.Text;
            kt.NoktaTuru = txtNoktaTuru.Text;
            imdb.Katilimcis.InsertOnSubmit(kt);
            imdb.SubmitChanges();
            int idsi = kt.KID;

            ds.DosyaAD = dosyaAdi;
            ds.DosyaICERIK = icerik;
            ds.DosyaTIP = dosyaTipi;
            ds.KID = idsi;
            imdb.Dosyalars.InsertOnSubmit(ds);

            imdb.SubmitChanges();

        }
        catch (Exception ex)
        {
            lblHataci.Text = ex.Message;
        }
    }
}

here is my question..How do i show my images that i was saving on sql server?on asp.Net website with linq queries?

Thanks for your answer...

+1  A: 

you can use the solution to this question as long as you get the contents of the image from the database. it doesnt depend on any linq-to-sql.

http://stackoverflow.com/questions/21877/dynamically-rendering-aspimage-from-blob-entry-in-asp-net

John Boker