How to Databind PictureBox to database

databind , picturebox , sql server India
  • 12 years ago
    I have a winform with one pictureBOx and one datanavigator control. I want to bind them to Northwind Employees table(Photo column) with the following code. I can see the images and can navigate through them also thru the datanavigator. But the images are not clear(hazy). can anybody help me out? --------------------------------------------------------------------- string connString = @"Data Source=local\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"; string data = "Select * from Employees"; SqlConnection conn = new SqlConnection(connString); SqlDataAdapter da = new SqlDataAdapter(data, conn); DataSet ds = new DataSet(); da.Fill(ds, "Employees"); this.pictureBox1.DataBindings.Add("Image", ds, "Employees. Photo"); ------------------------------------------------------------ Can anybody give me the correct code? Thanks

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry