.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Binary Data Problem....save and retrive image data from sql database

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :ASP.Net

hello friends...please help me to solve this problem....

i have created crud (create, retive, update and delete)form and it's running... here i want to add images for each record(sql database)....

i'm using image datatype in sql table for picture.....

Q 1: how to save and retrive binary data(image) from sql table in asp.net form using vb coding?

Q2: can i create sql table which store binary(image url) data direct?

thank you

View Complete Post

More Related Resource Links

Problem to save infopath form data in database.

Hi i have a win application which host infopath forms. i want to save infopath form data in database. to do this, in my table, i have xml dataType which store infopath form data. my problem is when i load xml form into string variable and save to database, i got this exception : XML parsing: line 1, character 38, unable to switch the encoding Here is my sample infopath form data in xml format : <?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="" productVersion="12.0.0" PIVersion="" href="file:///C:\Users\Hamed\Documents\customForm1.xsn" name="urn:schemas-microsoft-com:office:infopath:customForm1:-myXSD-2010-09-11T10-56-47" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?><my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-09-11T10:56:47" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us"> <my:txtFirstName>b</my:txtFirstName> <my:txtLastName>c</my:txtLastName> <my:txtFatherName>d</my:txtFatherName> <my:txtNationalCode>e</my:txtNational

Generating for each data in Database new Image

Hello everybody! I have the next problem. I have in Database about 100 rows with X and Y coordinates. I have the one image -> "Car.png" How can I in one statement show all 100 cars in my Wpf Application ? ( generate for about 100 Image objects ). Best Regards, Oleg

Basic data type problem with database insert

Hi,I'm trying to write some values into a database, but I think there's an issue with the data types.  Here's what I've got: public static string Hello(string pageId, string inOut) { string itemId = ""; string period = ""; var cookie = HttpContext.Current.Request.Cookies["visitorGUID"].Value; SqlConnection conn; SqlCommand comm; conn = new SqlConnection(GlobalSettings.DbDSN); comm = new SqlCommand("INSERT INTO myTable (memberGUID) VALUES (@memberGUID);", conn); comm.Parameters.Add("@memberGUID", System.Data.SqlDbType.Text); comm.Parameters["@memberGUID"].Value = cookie; try { conn.Open(); comm.ExecuteNonQuery(); return "Item added: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } catch { return "Item caught: cookie = " + cookie + " / pageId = " + pageId + " / inOut = " + inOut + " / pageId = " + pageId + " / itemId = " + itemId + " period = " + period; } finally { conn.Close(); } } At the moment I'm just trying to insert the value of the cookie into the database as a test.  It works fine when I

how to save radiobuttonlist data into database when they are in disable position

hiiiiiam using 2 radio buttonlist controls in web application they are FIRST      Yes    NoSECOND  Yes    NoInitially  SECOND radio button list is in disable position.when i was click on yes of FIRST radio button list, then SECOND radio button list is enables otherwise it is in disable mode only.here my problem is when i am inserting data into the database the disable radio button list gives error as System.NullReferenceException: Object reference not set to an instance of an object.code written for inserting isprotected void Button1_Click(object sender, EventArgs e)    {                    SqlConnection con = new SqlConnection(@"Data Source=STS2\SQLEXPRESS;Initial Catalog=STS;Integrated Security=True");            string sql;            sql = "insert into Table1(";            sql += "First,Second)";            sql += "values('";            sql += rbl_first.SelectedItem.Value.ToString() + "&

Writing image binary data to the Response


Hi there,

I've created 2 web user controls. A = User control that displays an image, and B is the user control that hosts A. I'm trying to stream an array of bytes to A, but it seems like the Response.BinaryWrite method completely overwrites any heirachial controls (I can't see any of B's other controls besides the image).

How do I get A to just display the image from the byte stream? It doesn't come from a database, it's an image I created on the fly.

A's code:

        public void UpdateImage(byte[] imgbytes)
            Response.ContentType = "image/jpg";


Binary Data Not Writing to Database


I have an ASP.NET app that writes binary data to a SQL database.  It worked fine using SQL Express, but does not ever write the data using SQL Server 2008 R2.  SQL Profiler shows the binary data in the UPDATE query, but nothing happens... no errors, no data saved.  Does anyone know what I'm missing?  Other data types work fine.

My data type is VarBinary(MAX)...


Binary Data Not Writing to Database

This may be more of a dev question, but I have an ASP.NET app that saves binary data to a SQL database.  It worked fine to a SQL Express 2008 database, but does not work on a SQL Server 2008 R2 Standard.  SQL Profiler shows the binary data in the UPDATE query, but nothing is ever actually written to the database.  I cannot find any errors either.  I have no problems writing other types of data.  Any ideas?

unable to save data in SQL Server database through Sharepoint 2007


Hi All,

I have created dummy database, Table in SQL Server 2005 with some values.
Iam able to pull data from the SQL database to sharepoint dataview webpart through data connection using sharepoint desigher.

Now i have to enter new record in to SQL table through sharepoint. i have checked with sharepoint designer but unable get it done.

Can some one have idea on this. Please help me to get it done

Thanks in Advance.

How to insert Binary Image data from XML To Excel using XSLT


Hi All,

I had created a XSLT which converts the XML file generated from the system to the excel format. The XSLT has the styles required for this transformation.

Now i am told to insert image in one of the excel columns using XSLT. The image is in binary code format in the XML file.

Tried to google but could not found the syntaxes for this. Let me know if anyone has done the image embedding in excel using XSLT.


ASP.Net Create physical image from binary data in Sybase


I want to extract an image from a third party Sybase table which has binary data in it.

To store images they use the following query:

SELECT xp_write_file('C:\photo-1.gz', col_name) FROM tbl_name

What I am trying to do is convert the binary data stored to a actual physical file using .Net

Any help would be appreciated.

Save data in database through jquery and display in grid


Hiii.......i want to make a twitter like registration form using jquery and save data in database and display it in a grid after submitting data.this is what i got on net

  1. <script src="Script/jquery-1.4.min.js" type="text/javascript"></script>  
  2. Linq - add data to database then email user the details


    Hi all

    I'm not sure how to structure the code for this but what I want to do is be able to add data to a database, and once this has completed successfully, then email the user to say the details have been added successfully to the database.

    I need to:

    1. Check that the relevant data has been added into the database then

    2. Email the details of the relevant data when completed. 


    Thanks in advance for your help,




huge number of data from database ... so how to minimize load time


Hi ...

I have used the above method to configure my crystal report ...

Its working fine , But i have huge number of data in database ....

So , it take long time to load the report ...

So , i have decided to show only the last 50 records inserted into the database , not all the 500 records to be loaded every time.

Plz help me with this issue  ...


Also , Plz explain me abt index legend in crystal report.

Saving textbox data to MySql database in asp.net


Hi dear coders

though a very simple question to ask, but please tell me how to save and retrieve data in/from my textboxes to/from database (MYSQL) on submit button click.

i know its a very simple task but i cant make it done, so i request you to please send me some working example link or post any helpful code here in asp.net

i will be highly thankful for any kind help from you geniuses.



Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

MySql.Data assembly problem



I added refernece MySql.Data to my project. My web.config looks like that:

<?xml version="1.0"?>
                <add assembly="MySql.Data, Version=, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>

But when in ServerExplorer I try "Add Connection..." I can't find "MySql Database" in the "Choose Data Source" dialog box?

What the problem can be?

server side does not save data when using POST data to another URL using WebRequest


 I am using a IIS 7.5 on Windows 7. I have a simple application that uses System.Net.WebRequest to POST data to another URL (in fact, the server side URL is on my local computer and it is hosted in IIS 7.5).

  1.  The problem is the server does not save data from client although on the client side codes when I debug and I see the OK message return from the code line

   response.StatusDescription; // this has value of "OK"
2. How can I debug the server code side where to receive the request from client side who posts the data ?

The following is the codes for client who posts data using System.Net.WebRequest, and codes for server side who received posted data to save to database.

Client side codes: // also run on my local computer

public string PostIntegrationXml(XmlDocument xmlSubmitDoc)




ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend