Backup and restore database from mysql:
From Dos Command Prompt(First Go Inside-C:\Program Files\MySQL\MySQL Server 5.0\bin)
Then Fire command as like--
mysqldump -u root -psa1234 databasename > c:/databasename.sql
REstore:
mysql -u [uname] -p[pass] [db_to_restore] < c:/databasename.sql
mysql -u root -pSa1234 -D photochat < c:/photochat.sql
Friday, January 14, 2011
Monday, December 6, 2010
Implementing Paging In Repater or Datalist
aspx Page
<%# Container.DataItem %>
C# File
public int PageNumber
{
get
{
if (ViewState["PageNumber"] != null)
return Convert.ToInt32(ViewState["PageNumber"]);
else
return 0;
}
set
{
ViewState["PageNumber"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
LoadData();
}
protected void rptPages_ItemCommand(object source, RepeaterCommandEventArgs e)
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
LoadData();
}
private void LoadData()
{
DataTable dt = YatraGuruBL.Interface.Methods.Help.Get();
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 3;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPages.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPages.DataSource = pages;
rptPages.DataBind();
}
else
rptPages.Visible = false;
rptItems.DataSource = pgitems;
rptItems.DataBind();
}
Page: |
C# File
public int PageNumber
{
get
{
if (ViewState["PageNumber"] != null)
return Convert.ToInt32(ViewState["PageNumber"]);
else
return 0;
}
set
{
ViewState["PageNumber"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
LoadData();
}
protected void rptPages_ItemCommand(object source, RepeaterCommandEventArgs e)
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
LoadData();
}
private void LoadData()
{
DataTable dt = YatraGuruBL.Interface.Methods.Help.Get();
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 3;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPages.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPages.DataSource = pages;
rptPages.DataBind();
}
else
rptPages.Visible = false;
rptItems.DataSource = pgitems;
rptItems.DataBind();
}
Sunday, November 28, 2010
Jquery Tutorial Easy way to learn jquery
Learn Jquery in a very easy manner by go to this link.You can learn it in maximum a week.
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery#Next_steps
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery#Next_steps
Tuesday, November 9, 2010
Validate start date and end date
//.aspx page code
button1.attributes.add("onclick","return Myfunction;")
For Different date time Formats
For Different Date time Formats Please Visit the link
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
Thursday, October 28, 2010
Select resords in range of two date
select * from orders WHERE orderdate >= '10/26/2010' and orderdate <= '10/29/2010'
Join More than 2 tables in sql
Joining Three or More Tables
Although each join specification joins only two tables, FROM clauses can contain multiple join specifications. This allows many tables to be joined for a single query.
The titleauthor table of the pubs database offers a good example of a situation in which joining more than two tables is helpful. This Transact-SQL query finds the titles of all books of a particular type and the names of their authors:
USE pubs
SELECT a.au_lname, a.au_fname, t.title
FROM authors a INNER JOIN titleauthor ta
ON a.au_id = ta.au_id JOIN titles t
ON ta.title_id = t.title_id
WHERE t.type = 'trad_cook'
ORDER BY t.title ASC
Here is the result set:
au_lname au_fname title
----------------- -------------------- ----------
Blotchet-Halls Reginald Fifty Years in Buckingham Palace
Kitchens
Panteley Sylvia Onions, Leeks, and Garlic:
Cooking Secrets of the Mediterranean
O'Leary Michael Sushi, Anyone?
Gringlesby Burt Sushi, Anyone?
Yokomoto Akiko Sushi, Anyone?
(5 row(s) affected)
Notice that one of the tables in the FROM clause, titleauthor, does not contribute any columns to the results. Also, none of the joined columns, au_id and title_id, appear in the results. Nonetheless, this join is possible only by using titleauthor as an intermediate table.
The middle table of the join (the titleauthor table) can be called the translation table or intermediate table, because titleauthor is an intermediate point of connection between the other tables involved in the join.
When there is more than one join operator in the same statement, either to join more than two tables or to join more than two pairs of columns, the join expressions can be connected with AND or with OR.
Although each join specification joins only two tables, FROM clauses can contain multiple join specifications. This allows many tables to be joined for a single query.
The titleauthor table of the pubs database offers a good example of a situation in which joining more than two tables is helpful. This Transact-SQL query finds the titles of all books of a particular type and the names of their authors:
USE pubs
SELECT a.au_lname, a.au_fname, t.title
FROM authors a INNER JOIN titleauthor ta
ON a.au_id = ta.au_id JOIN titles t
ON ta.title_id = t.title_id
WHERE t.type = 'trad_cook'
ORDER BY t.title ASC
Here is the result set:
au_lname au_fname title
----------------- -------------------- ----------
Blotchet-Halls Reginald Fifty Years in Buckingham Palace
Kitchens
Panteley Sylvia Onions, Leeks, and Garlic:
Cooking Secrets of the Mediterranean
O'Leary Michael Sushi, Anyone?
Gringlesby Burt Sushi, Anyone?
Yokomoto Akiko Sushi, Anyone?
(5 row(s) affected)
Notice that one of the tables in the FROM clause, titleauthor, does not contribute any columns to the results. Also, none of the joined columns, au_id and title_id, appear in the results. Nonetheless, this join is possible only by using titleauthor as an intermediate table.
The middle table of the join (the titleauthor table) can be called the translation table or intermediate table, because titleauthor is an intermediate point of connection between the other tables involved in the join.
When there is more than one join operator in the same statement, either to join more than two tables or to join more than two pairs of columns, the join expressions can be connected with AND or with OR.
Subscribe to:
Posts (Atom)