Tuesday, November 27, 2007

Oracle Find or Counts Number Of Row(s) And Column(s) In A Table

select count(*) from TableName // To Count The Number of Row(s) in a Particular table

Ex: Select Count(*) from emp;

select count(*) from user_tab_columns where table_name='TABLENAME';

// To Count The Number of Column(s) in a Particular table,

Note :TABLENAME Should be UPPERCASE Letter

Ex: Select  count(*) from user_tab_columns where table_name = 'EMP'

Friday, November 2, 2007

Dynamically Writing into Web.config File

Inline
    XmlDocument xDoc = new XmlDocument(); // Gobal Declaration
string Path; // Gobal Declaration
int i; // Gobal Declaration
protected void Page_Load(object sender, EventArgs e)
{
i = Convert.ToInt32(ConfigurationManager.AppSettings["Test"].ToString());
}
protected void bt1_Click(object sender, EventArgs e)
{
Path = Server.MapPath("~/web.config");
xDoc.Load(Path);
XmlNodeList NodeList = xDoc.GetElementsByTagName("appSettings");
XmlNodeList tNodeList = NodeList[0].ChildNodes;
XmlAttributeCollection xAttColl = tNodeList[0].Attributes;
xAttColl[0].InnerXml = "Test";
xAttColl[1].InnerXml = Convert.ToString(i + 1);
xDoc.Save(Path);
Response.Write(ConfigurationManager.AppSettings["Test"].ToString());
}

Web.Config

<configuration>

<appSettings>

<add key="Test" value="0" /> <!-- Add This In Your WebConfig File -->

</appSettings>

</configuration>

Friday, October 19, 2007

Solution For Sys.WebForms.PageRequestManagerTimeoutException

< asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeOut="300" >

</
asp:ScriptManager>

By Default AsyncPostBackTimeOut Property Value's 90 sec

Ajax UpdatePanal Custom Error Handling

Put This Code Within Inline Form Tag,
Note:Dont Put This JavaScript As a Seperate js File in your project,
use within a form tag

<form id="form1" runat="server">
<script language="javascript" type="text/javascript">


function pageLoad(sender, args)
{

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);

}

function beginRequest(sender, args)
{

.
.
.


}

function endRequest(sender, args)
{

var e = args.get_error();

if (e != null)
{
args.set_errorHandled(true);
alert('Custom Error');
}

}
</script>
</form>

Friday, October 5, 2007

set session timeout in webconfig

<configuration>

<system.web>

<sessionState mode="Off|InProc|StateServer|SQLServer"
<!--
Mode : Specifies where to store the session state.
Off : Indicates that session state is not enabled.
InProc : Indicates that session state is stored locally.
StateServer : Indicates that session state is stored on a remote server.
SQLServer : Indicates that session state is stored on the SQL Server.
-->
cookieless="true|false"
<!--
cookieless : Specifies whether sessions without cookies should be used to identify client sessions.
true : Indicates that sessions without cookies should be used.
false : Indicates that sessions without cookies should not be used. The default is false.
-->
timeout="number of minutes"
<!--
timeout : Specifies the number of minutes a session can be idle before it is abandoned. The default is 20.
-->

stateConnectionString="tcpip=server:port"

<!--
stateConnectionString :Specifies the server name and port where session state is stored remotely.
For example, "tcpip=127.0.0.1:42424". This attribute is required when mode is StateServer.
-->
sqlConnectionString="sql connection string"

<!--
sqlConnectionString : Specifies the connection string for a SQL Server.

For example, "data source=localhost;Integrated Security=SSPI;Initial Catalog=northwind".
This attribute is required when mode is SQLServer.
-->
stateNetworkTimeout="number of seconds"/>

<!--
stateNetworkTimeout : When using StateServer mode to store session state,specifies the number of seconds the TCP/IP network connection between the Web server and the state server can be idle before the session is abandoned. The default is 10.
-->
</system.web>

</configuration>