Results 1 to 5 of 5

Thread: Saving an Image to a SQL server db

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183

    Saving an Image to a SQL server db

    Hi there,
    I have an asp.net page that generates an image based on a bunch of user input provided through the page. Once the image is generated it dislays it up on the webpage as a url source (as the image is created on a seperate server) I now want to save that image to my sqlserver db, any ideas?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342

    chk if this helps u...

    save the path of the image file in the databse and later u can retrieve that image from that path
    ksm

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183
    Ok...... but how?

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    It's probably safer to store the actual image in a BLOB, depending upon the size of the image.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183
    ok assuiming I save the image as a blob in the database, here is some simple code to get a handle on an image, how do I bind it to the image when the only fields I can see to work with are the imageurl?

    SqlConnection dbConn = new SqlConnection("data source=localhost;initial catalog=pubs;UID=sa;PWD=;");
    string sSqlQuery = "SELECT Logo FROM pub_info WHERE pub_id=0736";
    SqlDataAdapter da = new SqlDataAdapter( sSqlQuery,dbConn);

    // Load into memory
    DataSet ds = new DataSet();
    da.Fill( ds );
    // Check for data
    if( ds.Tables[0].Rows.Count > 0 ) {
    ????????????????????????????????????????????
    Image.ImageUrl(
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width