function printpr()
{
if (navigator.appVersion.indexOf("IE 5.0")>=0 || navigator.appVersion.indexOf("IE 6.0")>=0)
{
var OLECMDID = 7;
/* OLECMDID values:
• 6 – print
• 7 – print preview
• 1 – open window
• 4 – Save As
*/
var PROMPT = 1; //note PROMPT = 2 -DO NOT PROMPT USER
var WebBrowser = ‘’;
document.body.insertAdjacentHTML(‘beforeEnd’, WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = “”;
}
else
{
self.print();
}
}
Search This Blog
Friday, December 4, 2009
Tuesday, December 1, 2009
How to display one group per page in a Crystal Report
If your crystal report is grouped by a field and you want to display one group per page of your crystal report then go to section expert of group header( to which you want to display per page), check to New Page Before and write condition as:-
GroupNumber <> PageNumber
After doing above, save the changes. Now it is ready to fulfill your requirement.
GroupNumber <> PageNumber
After doing above, save the changes. Now it is ready to fulfill your requirement.
Thursday, November 12, 2009
How to use identity column in a SQL select statement
Using following statement we can select identity column in a SQL select statement.
SELECT Userid,ServiceLineID,IDENTITY(int,1,1) AS i2
INTO #t
FROM users
ORDER BY ServiceLineID
SELECT * FROM #t
DROP TABLE #t
SELECT Userid,ServiceLineID,IDENTITY(int,1,1) AS i2
INTO #t
FROM users
ORDER BY ServiceLineID
SELECT * FROM #t
DROP TABLE #t
How to find width and height of an image using javascript
Using javascript we can get width and height of an image as follows.
var newImg = new Image();
newImg.src = 'file://D:\image\img123.gif';
var height= newImg.height;
var width= newImg.width;
var newImg = new Image();
newImg.src = 'file://D:\image\img123.gif';
var height= newImg.height;
var width= newImg.width;
Friday, July 10, 2009
Internal SQL Server error
Server: Msg 8624, Level 16, State 13, Line 1
Internal SQL Server error.
if above error comes it means that you are missing
GROUP BY in inner query.
Internal SQL Server error.
if above error comes it means that you are missing
GROUP BY in inner query.
Thursday, July 9, 2009
Update a table from another table
Below is the sql statement to update one table from another table.In the following case memodtl is getting update from podtl.
UPDATE memodtl
SET type=y.type, origin=y.origin, Grade=y.Grade, length=y.length, width=y.width, thickness= y.Thickness, MemoQty=y.Nos
FROM podtl y
WHERE memodtl.memono=y.pono and memodtl.memodt=y.podt and memodtl.revNo = y.RevNo and memodtl.RecNo=y.ReCno and memodtl.SeqNo = y.SeqNo
UPDATE memodtl
SET type=y.type, origin=y.origin, Grade=y.Grade, length=y.length, width=y.width, thickness= y.Thickness, MemoQty=y.Nos
FROM podtl y
WHERE memodtl.memono=y.pono and memodtl.memodt=y.podt and memodtl.revNo = y.RevNo and memodtl.RecNo=y.ReCno and memodtl.SeqNo = y.SeqNo
Friday, June 12, 2009
How to bind gridview from dataset using XSLT
-------------------------------
1:-XSLT file: Books.xsl
This is your XSLT file code
-------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<books>
<xsl:apply-templates select="//book"/>
</books>
</xsl:template>
<xsl:template match="book">
<xsl:if test="price > 200">
<book>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="specialization">
<xsl:value-of select="specialization"/>
</xsl:attribute>
<xsl:attribute name="author">
<xsl:value-of select="author"/>
</xsl:attribute>
<xsl:attribute name="publication">
<xsl:value-of select="publication"/>
</xsl:attribute>
<xsl:attribute name="price">
<xsl:value-of select="price"/>
</xsl:attribute>
</book>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--------------------------
2:-GridView Control
------------------------
add a gridview control in your web page with xmlDataSource as follows:
<asp:GridView ID="gvXML" runat="server" DataSourceID="XmlDataSource1">
<HeaderStyle BackColor="Gray" />
</asp:GridView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" TransformFile="~/BindGridView.xsl">
</asp:XmlDataSource>
Note:This control always look data in <book name="ask" price="1220"> </book>
format
----------------------------
3:-C# code
Add this code in your Code-Behind file
--------------------------
SqlConnection myCon = new SqlConnection(@"data source=192.168.2.200\sql2k;uid=sa;pwd=bench;database=DMS1");
SqlDataAdapter da = new SqlDataAdapter("select name, price, specialization, author, publication from book", myCon);
DataSet ds = new DataSet();
ds.DataSetName = "books";
da.Fill(ds, "book");
xmlDataSource2.Data = ds.GetXml();
After doing the above steps you will get the following output
1:-XSLT file: Books.xsl
This is your XSLT file code
-------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<books>
<xsl:apply-templates select="//book"/>
</books>
</xsl:template>
<xsl:template match="book">
<xsl:if test="price > 200">
<book>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="specialization">
<xsl:value-of select="specialization"/>
</xsl:attribute>
<xsl:attribute name="author">
<xsl:value-of select="author"/>
</xsl:attribute>
<xsl:attribute name="publication">
<xsl:value-of select="publication"/>
</xsl:attribute>
<xsl:attribute name="price">
<xsl:value-of select="price"/>
</xsl:attribute>
</book>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--------------------------
2:-GridView Control
------------------------
add a gridview control in your web page with xmlDataSource as follows:
<asp:GridView ID="gvXML" runat="server" DataSourceID="XmlDataSource1">
<HeaderStyle BackColor="Gray" />
</asp:GridView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" TransformFile="~/BindGridView.xsl">
</asp:XmlDataSource>
Note:This control always look data in <book name="ask" price="1220"> </book>
format
----------------------------
3:-C# code
Add this code in your Code-Behind file
--------------------------
SqlConnection myCon = new SqlConnection(@"data source=192.168.2.200\sql2k;uid=sa;pwd=bench;database=DMS1");
SqlDataAdapter da = new SqlDataAdapter("select name, price, specialization, author, publication from book", myCon);
DataSet ds = new DataSet();
ds.DataSetName = "books";
da.Fill(ds, "book");
xmlDataSource2.Data = ds.GetXml();
After doing the above steps you will get the following output
| name | specialization | author | publication | price |
|---|---|---|---|---|
| ASP.Net 3.5 | Web Programming Using C# and VB | Bill Thomas | Wrox | 560.00 |
| C# 3.5 | C# 2008 Powered by Microsoft | Microsoft Team | Wrox | 600.00 |
Subscribe to:
Posts (Atom)