Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 516579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:44:45+00:00 2026-05-13T07:44:45+00:00

I have a table in my SQL database that stores an AccountID and an

  • 0

I have a table in my SQL database that stores an AccountID and an ImageID – the ImageID being a file path to an actual account image in .gif format.

What would I need to do is, to retrieve the image from the file path saved on my SQL database onto an image control? I am using asp.net in c#.

Potentially, when the page is accessed, depending on which account has logged on, the appropriate image specific for the account is retrieve (I would imagine I can set up an @AccountID parameter at a later date)

If anyone has example code for something they have done similarly, I would be most grateful for any pointers you may have.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:44:45+00:00Added an answer on May 13, 2026 at 7:44 am

    Here’s a sample:

    var connectionString = ConfigurationManager.ConnectionStrings["SomeCN"].ConnectionString;
    using (var cn = new SqlConnection(connectionString))
    using (var cmd = cn.CreateCommand())
    {
        cn.Open();
        cmd.CommandText = "select imageid from accounts where accountid = @accountid";
        cmd.Parameters.AddWithValue("@accountid", 5);
        using (var reader = cmd.ExecuteReader())
        {
            if (reader.Read())
            {
                var filePath = reader.GetString(0);
                // For this to work images must be stored inside the web application.
                // filePath must be a relative location inside the virtual directory
                // hosting the application. Depending on your environment some
                // transformations might be necessary on filePath before assigning it
                // to the image url.
                imageControl.ImageUrl = filePath;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in the database that I'm retrieving using LINQ to SQL,
I have a table in a SQL Server 2005 database with a trigger that
FYI: SQL Server 2005 I have a database user account (user_web) that has the
I have a SQL Server 2005 database that stores data for multiple users. Each
In a SQL server database, I have a table which contains a TEXT field
Lets say I have a table in a sql server 2000 database called TransactionType:
I have a field (say, foo) in a table in a SQL Server database
I have a SQL Mobile database with one table. It has several columns with
I have a database (NexusDB (supposedly SQL-92 compliant)) which contains and Item table, a
I need to write an SQL-Query for a csv-export. I have a table stores,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.