Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Wednesday, October 29, 2014

C#- SQL Parameter how to use in asp.net

What is the SQL Parameter how to use:-



SqlParameter:-

  • Refer a parameter to a SqlCommand and optionally its mapping to Dataset.
  • SqlParameter names are not case sensitive. 
  • SqlParamenter is a class we initialize a new instance of SqlParameter class. 
  • SqlParamenter is part of the System.Data.SqlClient namespace.
  • SqlParamenter provides an easy and fast way to parameterize queries.


This class Provide many type of constructors, we can use many constructors as like :–

  • SqlParameter():initialize a new instance of SqlParameter class.
  • SqlParameter(String, SqlDbType): constructor require parameter name and data type.
  • SqlParameter(String, Object): constructor require parameter name and a value of the new SqlParameter.
  • SqlParameter(String, SqlDbType, Int32): constructor require parameter name, SqlDbType and size..
  • SqlParameter(String, SqlDbType, Int32, String): require parameter name , SqlDbType, size and the source column name.

if you want to start with sql then see this post Learn SQL with Asp.net C#




SqlParameter class provides many useful properties such as:-
  • CompareInfo,
  • DbType,
  • Direction,
  • IsNullable,
  • Offset,
  • ParameterName:- property get or set the SqlParameter name
  • Precision, Scale, Size,
  • SourceColumn,
  • SqlDbType: get or set the SqlDbType (SQL Server specific data type) for the parameter. Enumeration values are Binary, Bit, BigInt, Char, DateTime, Date, Decimal, Float, Image, Int, Real, Text, Time, Timestamp, Money etc.
  • SqlValue,
  • TypeName,
  • Value etc.





Sql Server Interview Qus:

1 comment: