Insert image in a database
ADO.NET provides database connectivity between relational and non relational systems through a common set of components . SQL Server supplies a set of system data types that define all the types of data that can be used with SQL Server. Image is a Datatype in SQL Server that stores variable length binary data from 0 through 2A31-1 (2,147,483,647) bytes. The following VB.NET program shows how to insert an Image in SQL Server.
First you have to create a table that contain an image column . The following sql script help you to create a table with Image Datatype column :
The above scrip will create a table named as imgtable and adding two column , first column is id ,an integer datatype and second column is image, an image(img) datatype.
The following VB.NET source code read the image from physical path D:\picfile.jpg and stores it to a byte array and then insert it into database.
- What is ADO.NET Dataset
- How to Dataset with Sql Server
- How to Dataset with OLEDB Data Source
- Search Tables in a Dataset Sql Server
- Search Tables in a Dataset OLEDB Data Source
- Dataset table row count in SQL Server
- Dataset table row count - OLEDB Data Source
- How to find column definition - Sql Server
- How to find column definition - OLEDB Data Source
- How to create DataSet without Databse
- How to multiple tables in Dataset - Sql Server
- How to multiple tables in Dataset - OLEDB Data Source
- How to add relations between tables in a Dataset
- How to merge tables in a Dataset - Sql Server
- How to merge tables in a Dataset - OLEDB Data Source
- How to populate a combo box from a dataset in VB.Net , binding combobox with enum values , binding combobox with dictionary values
- how many tables exist in a database - VB.NET