Course Hero Logo

ICTPRG5203_Week 2Online Activities_Done.docx - ICTPRG5203...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 3 out of 12 pages.

ICTPRG5203 –WEEK ONLINE ACTIVITIESCOMPLETE THE FOLLOWING ACTIVITIES AND TASKSASSIGNMENT 3Task 1What doesSqlCommand.ExecuteNonQuery Method ()andSqlCommand. ExecuteReader()do ?A:1)SqlCommand.ExecuteNonQuery Method ():Executes a Transact-SQL statement against theconnection and returns the number of rows affected.public override int ExecuteNonQuery ();ReturnsInt32The number of rows affected.ImplementsExecuteNonQuery()ExceptionsInvalidCastExceptionA SqlDbType other than Binary or VarBinary was used when Value was set to Stream.A SqlDbType other than Char, NChar, NVarChar, VarChar, or Xml was used when Value was setto TextReader.A SqlDbType other than Xml was used when Value was set to XmlReader.SqlExceptionAn exception occurred while executing the command against a locked row. This exception is notgenerated when you are using Microsoft .NET Framework version 1.0.A timeout occurred during a streaming operation.IOExceptionAn error occurred in a Stream, XmlReader or TextReader object during a streaming operation.InvalidOperationExceptionThe SqlConnection closed or dropped during a streaming operation. For more information aboutstreaming, see SqlClient Streaming Support.ObjectDisposedExceptionThe Stream, XmlReader or TextReader object was closed during a streaming operation.2)ExecuteReader(): Sends the CommandText to the Connection and builds a SqlDataReader.public System.Data.SqlClient.SqlDataReader ExecuteReader ();ReturnsSqlDataReaderA SqlDataReader object.Exceptions
InvalidCastExceptionA SqlDbType other than Binary or VarBinary was used when Value was set to Stream.A SqlDbType other than Char, NChar, NVarChar, VarChar, or Xml was used when Value was setto TextReader.A SqlDbType other than Xml was used when Value was set to XmlReader.SqlExceptionAn exception occurred while executing the command against a locked row. This exception is notgenerated when you are using Microsoft .NET Framework version 1.0.A timeout occurred during a streaming operation.InvalidOperationExceptionThe current state of the connection is closed. ExecuteReader() requires an open SqlConnection.The SqlConnection closed or dropped during a streaming operation.IOExceptionAn error occurred in a Stream, XmlReader or TextReader object during a streaming operation.Task 2What is the function ofControl.DataBind Method ()Command in C# program? Give an Example ?A:The function of control.databind is to bind the data eg.gridview1.datasource=dataset;gridview1.dataBind();Example:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Data.SqlClient;namespace Akadia{// Shows Master-Detail, Table-Mapping, Fill a Comboboxpublic class MasterDetail : System.Windows.Forms.Form{.....

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 12 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Two
Professor
Haider Ali
Tags
Call stack, NET Framework, Division by zero

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture