Wednesday, December 21, 2016
Tuesday, December 20, 2016
FAQ – Day 1 : What is RDBMS?
Frequently Asked Questions – Day 1
RDBMS stands for Relational Database Management System.A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
RDBMS data is structured in database tables, fields and records. Each RDBMS table consists of database table rows. Each database table row consists of one or more database table fields.
RDBMS also provide relational operators to manipulate the data stored into the database tables. Most RDBMS use SQL as database query language.
The most popular RDBMS are MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
Friday, December 16, 2016
Count the number of tables in the SQL Server database.
Count the number of tables in the SQL Server database:
Using below SQL query to fetch the total number of table in the SQL Server database:Use Your_DataBaseNameSelect * from INFORMATION_SCHEMA.TABLES
Here you get total count of table(base table, view).
If you want fetch count of only TABLE in the database, write below query:
Select * from INFORMATION_SCHEMA.TABLESWhere TABLE_TYPE='BASE TABLE'
If you want fetch count of only VIEW count in the database, write below query:
Select * from INFORMATION_SCHEMA.TABLESWhere TABLE_TYPE='VIEW'
Tuesday, December 13, 2016
Delegate : Access method from parent page(aspx) to child page(control) using delegate.
Delegate : How to access method from parent page(aspx) to child page(control) using delegate.
Here i want to call function from parent page to child page. Here i have gridview at aspx(Detail.aspx) page. Also bindgrid() method having on code page. And i have create control on this page, at that control page i want reload bindgrid() method to refresh the gridview.
Method to bindGrid() at parent (aspx) page as below:
private void bindGrid()
{
DataTable dt = new DataTable();
dt = _clsDetail.GetData();
if (dt != null && dt.Rows.Count > 0)
{
gvDetail.DataSource = dt != null && dt.Rows.Count > 0 ? dt : null;
gvDetail.DataBind();
ViewState["gvDetail"] = dt != null && dt.Rows.Count > 0 ? dt : null;
}
}
For this functionality i have create a delegate, having no parameter on control page like:
public delegate void delegate_name();
public event delegate_name event_name;
Example:
public delegate void DataSaveCalled();
public event DataSaveCalled DataSaved;
And here i have call this DataSaved function after DetailSave button click as below at control page:
protected void btnDetailSave_Click(object sender, EventArgs e)
{
try
{
string strout = "";
bool status = false;
_clsDetail.add_Detail(out strout, out status);
if (status == true)
{
lblMsg.Text="Request added successfully.";
//To access the bindGrid() method here:
if (DataSaved != null)
{
DataSaved();
}
}
else
{
lblMsg.Text="Request not added.";
}
}
catch (Exception ex)
{ throw ex }
}
Now i assign that method from parend (aspx) page to control page using define delegate at child (control) page like:
At Page_Load() of parent (aspx) page:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
control_name.event_name += new Controls.control_name.delegate_name(assign_function_to_call);
}
}
Example:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ccShowRequest.DataSaved += new Controls.Detail.OnDataSaveCalled(bindGrid);
}
}
This is all about delegate, That you want to access method from parent page(aspx) to child page(control).
Wednesday, December 7, 2016
Concatenating Column Values into a Comma-Separated List into SQL Server
Here i am telling about concatenating column value into comma-separated list as below:
Declare @AllEmail AS VARCHAR(8000),@Position int=3
Declare @t table (ID int identity,EmailID nvarchar(200))
Insert into @t(EmailID)
Select distinct(EmailID) From Employee Where Position=@Position AND IsActive=1 AND IsDeleted=0
SELECT @AllEmail = ISNULL(@AllEmail +';','') + EmailID FROM @tHere you get output at resultset as comma separated email id.
SELECT @AllEmail
Subscribe to:
Posts (Atom)