Monday, December 6, 2010

Implementing Paging In Repater or Datalist

aspx Page

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();
}

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

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

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.

Tuesday, October 19, 2010

Import Access Data To Sql Server 2005

Transfer Access database to SQL Server 2005

Open SQL Server Management Studio and connect to the database server you want to import your Access database into. Under Databases, right-click and choose New Database.

new database sql 2005

Give it a name and configure the other settings as needed and click OK. Now we need to right-click on the database we just created and choose Tasks and then Import Data.

sql 2005 import data

On the Data Source dialog box, scroll up until you see Microsoft Access.

import microsoft access data

Next to File, click on Browse and navigate to the Access database you want to import and click Open. Note that the database cannot be in Access 2007 format as SQL Server 2005 does not recognize it! So if you have a 2007 Access database, first convert it to the 2002-2003 Access format by going to Save As.

mirgrate access to sql

Go ahead and click Next to choose the destination. Since you right-clicked on the database you wanted to import the data into, it should already be picked in the list.

destination database

Click Next and then specify how you want to transfer the data from Access to SQL by choosing either Copy the data from one or more tables or Write a query to specify the data to transfer.

access to sql server

In most cases, if you want to just transfer the entire database, you should choose the first option. If you want only a portion of the data from a particular table, you can write out the SQL query. Click Next.

By default all the tables should be selected and if you click the Edit button under Mapping, you’ll see the the destination database will create all of the tables to match what’s in the Access database.

transfer database access to sql

Here I have only one table in my Access database. Click Next and then choose whether to execute immediately or to save it as a file to perform later.

save as dts package

Click Next and then click Finish. You’ll then see the progress of the data transfer as it occurs.

transfer data

After it is completed, you’ll see the number of rows transferred for each table in the Message column.

data transferred

Click Close and you should now have all of your Access data
nicely imported into a SQL Server 2005 database, which you can then use for whatever you like.

access database

Any problems importing your data from Access to SQL 2005?piyushsen2002@gmail.com If so, post a comment and I’ll try to help!

Saturday, March 27, 2010

Converting PDF to Word Documents

Converting PDF to Word Documents

Summary: One way that documents are commonly shared with others is in the form of a PDF file. Getting information from a PDF file back into a Word format can be a challenge, however. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)


One of the most common ways of disseminating information is through PDF files. PDF, which stands for Portable Document Format, is the file format used by Adobe Acrobat. Many people receive information in PDF format, but then want to transfer that information to a Word document so they can work with it.
There are a couple of ways that you can get text from a PDF file to a Word document. Exactly which ones you can use depends on how the PDF file is protected. If the file is not protected, try these steps:
Open the PDF document and display the page that contains the text you want to copy to Word.
Click the Text tool on the toolbar.
Click and drag to select the text you want to copy, or (if you want to select all the text) click once in the text area and press Ctrl+A.
Press Ctrl+C to copy the selected text to the Clipboard.
Switch to your Word document.
Press Ctrl+V to paste the contents of the Clipboard into your document.
This transfers the text to your Word document. It is only the plain, unformatted text, but you can now work with it in Word.
If you have Adobe Acrobat 7 (or a later version) you can actually export a PDF document in either RTF or Word document format. (This won't work with Adobe Reader; you must have the full version of Acrobat.) Simply load the PDF and choose File | Save As. In the dialog box, choose Word document as the Save As Type. When you click Save, the document file is created.
If the PDF file is protected (authors can set security settings on PDF files so they are protected), then you won't be able to use either of the foregoing solutions. Instead, you will need to look to a third-party solution.
If you already have a scanner and OCR software, you can print the PDF file, then scan the document and use the OCR software to convert it to a Word document. One company has taken the OCR process a step further, allowing you to skip the scanning and instead convert directly from PDF. If you are interested in this product, it is called PDF Transformer, from ABBYY software:
http://www.abbyy.com/pdftransformer/
One thing that you should be aware of is that when you convert your PDF file to a Word document, that doesn't mean that the Word document will look like the original PDF looks. In most cases, the Word document will need a lot of formatting to make it look the way you want. The bottom line? You should only focus on getting the content from the PDF to Word, and not on the formatting; you can always do the formatting later.

How to Copy and Paste pdf format(file) into wort or any other file

When you need to convert only a part of the content in a PDF file to Microsoft Word, you can use the selection tools in Adobe Acrobat 6 Professional to copy and paste the required content without losing the formatting. You can copy text, tables, as well as images or parts of images, for pasting in Word. A note:THIS WILL NOT WORK IN THE FREE/BASIC VERSION OF ADOBE ACROBAT
editSteps

1To copy text from a PDF document
2Click the arrow on the Basic toolbar and select Select Text from the drop-down menu.
The pointer changes to a cursor shape.


3Select the text you want to copy.


4Press Ctrl + C to copy the selected text.
5In a Microsoft Word document, press Ctrl + V to paste the copied text.
The text is pasted in the Word document with loss of formatting.
6To copy a table from a PDF document
7Click the arrow on the Basic toolbar and select Select Table from the drop-down menu.
The pointer changes to a cross-hair shape [

].
8Drag the pointer to draw a border around the table you want to copy.


9Press Ctrl + C to copy the selected table.
10In a Microsoft Word document, press Ctrl + V to paste the copied table.
The table is pasted in the Word document with loss of formatting.
11To copy an image from a PDF document
12Click the arrow on the Basic toolbar and select Select Image from the drop-down menu.
When you move the pointer over an image in the PDF document, the pointer changes to a cross-hair shape [