using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; namespace CommonFunction { public partial class Operations { #region public sqlhelper function SqlConnection conCommon = new SqlConnection(); public DataSet ExecuteDataSet(CommandType cmdType, string cmdText) { try { DataSet dsCommon = new DataSet(); SqlCommand cmdCommon = new SqlCommand(cmdText, conCommon); cmdCommon.CommandType = cmdType; SqlDataAdapter adpCommon = new SqlDataAdapter(cmdCommon); conCommon.Open(); adpCommon.Fill(dsCommon); conCommon.Close(); return dsCommon; } catch { conCommon.Close(); return null; } } public DataSet ExecuteDataSet(CommandType cmdType, string cmdText, SqlParameter[] pArray) { try { DataSet dsCommon = new DataSet(); SqlCommand cmdCommon = new SqlCommand(cmdText, conCommon); cmdCommon.CommandType = cmdType; foreach (SqlParameter p in pArray) cmdCommon.Parameters.Add(p); SqlDataAdapter adpCommon = new SqlDataAdapter(cmdCommon); conCommon.Open(); adpCommon.Fill(dsCommon); conCommon.Close(); return dsCommon; } catch { conCommon.Close(); return null; } } public int ExecuteNonQuery(CommandType cmdType, string cmdText) { try { SqlCommand cmdCommon = new SqlCommand(cmdText, conCommon); cmdCommon.CommandType = cmdType; conCommon.Open(); int returnValue = cmdCommon.ExecuteNonQuery(); conCommon.Close(); return returnValue; } catch { conCommon.Close(); return 0; } } public int ExecuteNonQuery(CommandType cmdType, string cmdText, SqlParameter[] pArray) { try { SqlCommand cmdCommon = new SqlCommand(cmdText, conCommon); cmdCommon.CommandType = cmdType; foreach (SqlParameter p in pArray) cmdCommon.Parameters.Add(p); conCommon.Open(); int returnValue = cmdCommon.ExecuteNonQuery(); conCommon.Close(); return returnValue; } catch { conCommon.Close(); return 0; } } #endregion public sqlhelper function } }
Third Generation Resources Team
Tuesday, July 19, 2011
SQL Helper - A C# Helper Class
Tuesday, March 2, 2010
Master Page - Content Page Life Cycle
1. Master page controls Init event
2. Content controls Init event
3. Master page Init event
4. Content page Init event
5. Content page Load event
6. Master page Load event
7. Content controls Load event
8. Content page PreRender
9. Master page PreRender
10. Master page controls PreRender
11. Content controls PreRender event
Thursday, January 21, 2010
MooTools and jQuery conflict problem in Internet Explorer, noConflict
When we use MooTools and jQuery together in our page, common problem we found is that some functionality is not working properly for MooTools or jQuery
Sometimes it is hard to find out that the problem is in using both together
The solution is so simple. We have to say jQuery to not to conflict with other libraries.
You have to add jQuery.noConflict() to your jQuery code.
jQuery is namespaced so the $ function is free for MooTools to take hold of. The jQuery code passes jQuery to itself and then we call the argument $, thus jQuery is contained, so to speak.
Obviously including two libraries within the same page is resource-consuming but if it’s acceptable to the project and allows you to implement plugins from each library quickly, this may be a great option for you.
Sometimes it is hard to find out that the problem is in using both together
The solution is so simple. We have to say jQuery to not to conflict with other libraries.
You have to add jQuery.noConflict() to your jQuery code.
<p>jQuery sets this paragraph's color to red but MooTools sets the border color.</p>
<script type="text/javascript" src="jquery-1.3.js"></script>
<script type="text/javascript">
//no conflict jquery this makes possible to use both library together
jQuery.noConflict();
//jquery stuff
(function($) {
$('p').css('color','#ff0000');
})(jQuery);
</script>
<script type="text/javascript" src="moo1.2.js"></script>
<script type="text/javascript">
//moo stuff
window.addEvent('domready',function() {
$$('p').setStyle('border','1px solid #fc0');
});
</script>
<script type="text/javascript" src="jquery-1.3.js"></script>
<script type="text/javascript">
//no conflict jquery this makes possible to use both library together
jQuery.noConflict();
//jquery stuff
(function($) {
$('p').css('color','#ff0000');
})(jQuery);
</script>
<script type="text/javascript" src="moo1.2.js"></script>
<script type="text/javascript">
//moo stuff
window.addEvent('domready',function() {
$$('p').setStyle('border','1px solid #fc0');
});
</script>
jQuery is namespaced so the $ function is free for MooTools to take hold of. The jQuery code passes jQuery to itself and then we call the argument $, thus jQuery is contained, so to speak.
Obviously including two libraries within the same page is resource-consuming but if it’s acceptable to the project and allows you to implement plugins from each library quickly, this may be a great option for you.
Reset All Settings in Visual Studio 2008
1) Open command prompt
2) Go to location :
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\
3) Command to Reset Settings:
devenv /resetsettings
Wednesday, January 20, 2010
Best Javascript and Css Compresser - YUI Compressor
Brief Advantages of YUI Compressor
- Easy to use
- High compression rate
- Reliable end results (doesn't mess up the code)
If you are looking for a good compressor for your javascript YUI Compressor is the way to go.
Great compression rate, well tested and in use among many top sites, and well, personally recommended by me.
I've used it for my projects without a single JS error or hiccup. And it has nice documentation.
Note: Although Dan Edwards's packer achieves a better compression rate than YUICompressor, I ran into a few JS errors when using it.
Tuesday, January 19, 2010
Visitor's Browser Type, IP address and more in ASP
Here is a small code that can help you getting the ip address, browser type, request type and many more things..
<html>
<body>
<p>
<b>You are browsing this site with:</b>
<% Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>Local IP address is:</b>
<%Response.Write(Request.ServerVariables("local_addr"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>
<html>
<body>
<p>
<b>You are browsing this site with:</b>
<% Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>Local IP address is:</b>
<%Response.Write(Request.ServerVariables("local_addr"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>
Tuesday, October 13, 2009
jQuery scrollTo plugin
jQuery has many great plugins.
Here is another one.
scrollTo is one of my favorite ones.
It's very useful and can be use anywhere while scrolling.
It gives scrolling an animation which is good over the boring scrolling.
Here is a quick link for downloading scrollto plugin. jquery.scrollTo-1.4.2.zip
Here is a demo if you want to try it, and see how it works. Demo
Note: you will need jquery-1.3.2 to use scrollTo. jquery-1.3.2.js
Here is the official link to the jQuery website for scrollTo plugin. jQuery scrollTo Official
Here is another one.
scrollTo is one of my favorite ones.
It's very useful and can be use anywhere while scrolling.
It gives scrolling an animation which is good over the boring scrolling.
Here is a quick link for downloading scrollto plugin. jquery.scrollTo-1.4.2.zip
Here is a demo if you want to try it, and see how it works. Demo
Note: you will need jquery-1.3.2 to use scrollTo. jquery-1.3.2.js
Here is the official link to the jQuery website for scrollTo plugin. jQuery scrollTo Official
Subscribe to:
Posts (Atom)