i
Web Application Fundamentals
Using Internet Information Services
Web Forms
ASP.NET MVC
Web Services
ASP.NET Features
Request/Response Programming
HttpRequest Class
HTTP Collections
HttpResponse Class
Redirection
HttpUtility Class
Using Visual Web Developer
Visual Studio Forms Designer
Using Components
Shadow Copying
Using the Global.asax File
Data Binding
Different Types Of Caching
How to use Object cache
Optimizing Your ASP.NET Application
What Is Caching [Storage]
Forms Authentication
Windows Authentication
ASP.NET Security Fundamentals
Data Source Controls
SqlDataSource
SiteMapDataSource
The AccessDataSource Control
ObjectDataSource
Connection String Storage
GridView
DetailsView
FormView
ListView
DataPager
Entity Data Model
EntityDataSource
Remote Method Calls
Ajax Control Toolkit
Ajax Client Library
Rich Client Applications
Ajax [Asynchronous JavaScript and XML]
ScriptManager
UpdatePanel
Model-View-Controller Pattern
ASP.NET MVC versus Web Forms
ASP.NET MVC Projects in Visual Studio
Action Methods in MVC
Routing in MVC
Strongly-Typed Views [Add images here from the visual studio]
Model Binding
Validation
ADO.NET [ActiveX Data Object]
ASP.NET Data Providers
Connections
Commands
DataReaders and Connected Access
DataSets and Disconnected Access
SQL Commands: Allows you to perform the operations like insert, update, delete. The command object uses the connection objects to make a connection to the database. The query which we pass the command is in the form of the inline SQL statement or the stored procedure. SqlCommand's important factor is we can execute SQL queries and procedures directly.
Property of SqlCommand:
CommandTimeout: It Specifies that the time to wait when executing the command. Default Time for Execution is 30 Seconds.
Connection: The SqlConnection object that is used provides the entry point of the data source.
CommandText: Represents the Statements or the Stored Procedure.
Methods of SqlCommand:
ExecuteNonQuery: This returns the number of affected rows.
ExecuteReader: This returns the instance of SqlDataReader.
ExecuteScalar: This returns the first column of the first row of the result set. The remaining column & row are ignored.
Syntax of SqlCommand:
SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; |
Example:
public void CallToCommand() { Sqlconnectionection connection = new Sqlconnectionection(); connection.connectionectionString = ConfigurationManager.connectionectionStrings["connectionString"].connectionectionString; try { SqlCommand command = new SqlCommand(); command.connectionection = connection; command.CommandText = "DELETE FROM EMPLOYEE WHERE DEPTID = 40"; command.CommandType = CommandType.Text; connection.Open(); int AffectedRow = command.ExecuteNonQuery(); MessageBox.Show(AffectedRow + " rows affected", "Message"); command.Dispose(); connection.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } |
Don't miss out!