(1)Bind Image Control using SqlDataReader class
Database Table Design diagram:
Database Table Design diagram:
Database Table Query Design:
Record view of the Table
Step-1 : Drag and Drop Hyperlink control from ToolBox to Design window
Set property of the label control
Id= hypercontrol
Step-2: Open .CS file(code behind or logical file)
Add one namespace in your .cs
(a) using System.Data.SqlClient:
According to microsoft msdn network “The.NET Framework Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space.”
Step-3 Make connection to the MSSqlServer using SqlConnection Class
//So first we need to create object of the SqlConnection class
//Through this object , call ConnectionString property of SqlConnection class
//and assign connectionString which is contain four required parameter such as
//Servername,Databasename,userId,Password
//and assign connectionString which is contain four required parameter such as
//Servername,Databasename,userId,Password
//here use “@” for single backslash if you want without “@” sign then use double backslash in your connection string
//After assign connection string to Sqlconnection object. Call Open() method of SqlConnection class
//Perform Your DQL(select method) Query using SqlCommand class so first we need to create object of this class
//Write your Select query using where condition and Assign to CommandText Property of SqlCommand class
//After that connect your command with Sqlconnection so assign con instance to command object
//Take SqlDataReader class for reading Sql data
//Call ExecuteReader() method (only for DQL Queries) for SqlDataReader class
//Call ExecuteReader() method (only for DQL Queries) for SqlDataReader class
//after that use read() method for reading all data and assign to image control
No comments:
Post a Comment