Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I save a picture in the database as a binary, with the program even outside the network database, query and save the picture old timeout, I want to know is there any way you can save a picture and it makes queries quickly?
Posted

tell us more about the database, but initially

index the table to fit the query might be a good start


bryce
 
Share this answer
 
We can make it quickly by tow ways

1. storing the image in physical path and image name in database
2. Indexing the table
 
Share this answer
 
About saving images file in database, check this Answer by PO'H
Storing images,pdf and sound files[^]

About timeout, check these
Dirty ways
Increase timeout for SQL connection[^]
Increase timeout for SQL command[^].

Good ways
Use SQL Server Profiler[^]
How to identify SQL Server performance issues, by analyzing Profiler output?[^]
SQL Server Best Practices[^]
 
Share this answer
 
C#
private static void OpenSqlConnection()
{
    string connectionString = GetConnectionString();
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
        connection.Open();
        Console.WriteLine("State: {0}", connection.State);
        Console.WriteLine("ConnectionTimeout: {0}",
            connection.ConnectionTimeout);
    }
}

static private string GetConnectionString()
{
    // To avoid storing the connection string in your code,
    // you can retrieve it from a configuration file, using the
    // System.Configuration.ConfigurationSettings.AppSettings property
    return "Data Source=(local);Initial Catalog=AdventureWorks;"
        + "Integrated Security=SSPI;Connection Timeout=30";
}



VB
http://www.c-sharpcorner.com/UploadFile/hscream/ImagetoBinary02132007164649PM/ImagetoBinary.aspx[^]
http://stackoverflow.com/questions/1373032/c-howto-convert-image-to-binary[^]
http://www.dotnetspider.com/resources/6150-Convert-Image-binary-format.aspx[^]


try this code and also check these all links
provided by Bharat Technologies
 
Share this answer
 

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