Database Reference
In-Depth Information
For the Location property, set X to 12 and Y to 12.
Set the Multiline property to True.
For the Size property, set Width to 401 and Height to 117.
Leave the Text property blank.
4. Now your LoadImages form in the Design view should look like Figure 17-1.
Figure 17-1. The Design view of the LoadImages form
5. Navigate to Solution Explorer, select the LoadImages.cs form, right-click, and
select View Code; this will take you to the code editor window. Add the code to
LoadImages.cs shown in Listing 17-1.
Listing 17-1. LoadImages.cs
using System.Data;
using System.Data.SqlClient;
using System.IO;
// change this path to the location of image in your computer
string imageFileLocation = @"C:\VidyaVrat\C#2012 and SQL 2012\Chapter17\Code\";
string imageFilePrefix = "SpaceNeedle";
string imageFileType = ".jpg";
int numberImageFiles = 1;
int maxImageSize = 10000;
SqlConnection conn = null;
SqlCommand cmd = null;
private void LoadImages_Load(object sender, EventArgs e)
{
try
{
// Create connection
conn = new SqlConnection(@"server = .\sql2012;integrated security = true;
database = SQL2012Db");
 
Search WWH ::




Custom Search