Monday, December 01, 2008
How to view the buffered output using oracle stored procedure
(
EmpName in varchar2,
cv_results in out sys_refcursor
)
IS
begin
open cv_results for
Select * from Employee where EmplyoeeName=EmpName;
End;
If you want to see the output.
Go To -> TOAD --> Stored Procedure --> Right Click Execute Procedure
->Now Parameters window will open
->Enter the Arguments except Cursor
->click Options Button
->Now Output Options window will open
->Select Load into grid from memory option.
->Now Click OK..You can view the results in the grid.
Monday, November 24, 2008
Create and fill recordset using VB 6.0
If you want to run the below code, you need to add a reference of Microsoft Activex Data Objects 2.8 Library using References under Project.
Dim SpecailizedFunds As String
Dim fields() As String
SpecailizedFunds = "123456,456789"
fields() = Split(SpecailizedFunds, ",")
Dim rsTemp As ADODB.Recordset
Set rsTemp = New ADODB.Recordset
rsTemp.ActiveConnection = Nothing
rsTemp.CursorLocation = adUseClient
rsTemp.LockType = adLockBatchOptimistic
'create fields
rsTemp.fields.Append "Account", adChar, 6
rsTemp.Open
For i = 0 To UBound(fields)
rsTemp.AddNew
rsTemp.fields(0) = fields(i)
If Not rsTemp.EOF Then rsTemp.MoveNext
Next
If rsTemp.RecordCount > 1 Then
rsTemp.MoveFirst
Do Until rsTemp.EOF
MsgBox rsTemp.fields("Account").Value
rsTemp.MoveNext
Loop
End If
rsTemp.Close
Set rsTemp = Nothing
Friday, November 14, 2008
AJAX Object
Different browsers use different methods to create the XMLHttpRequest object.
Internet Explorer uses an ActiveXObject, while other browsers uses the built-in JavaScript object called XMLHttpRequest.
Other Browsers:
----------------
var xmlHttp;xmlHttp=new XMLHttpRequest();
Internet Explorer
------------------
var xmlHttp;
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); //IE 6.0+(or)
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");//IE 5.5+
Monday, April 02, 2007
Wednesday, August 09, 2006
Calling WebService from Javascript
This is webservice call from Javascript..
------------------------------------------
Webservice Name : Calculation.asmx
[WebMethod]
public int Add(int a,int b)
{
return a+b;
}
-------------------------------------------
// SOAP Structure.
string request =
"<soap:Envelope xmlns:xsi='http://wwww.w3.org/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/XMLSchema'
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<Add> // This is function name
<a> 1 </a> // Parameter 1
<b> 2 </b> // Parameter 2
</Add>
</soap:Body>
</soap:Envelope>";
// Create object for XML HTTP.
var objhttp = new ActiveXObject("MSXML2.XMLHTTP");
//Mention where the webservice is running [URL]
objhttp.open("POST","http://google.com/Calculation.asmx);
// function name
objhttp.setRequestHeader("SOAPAction","http://tempuri.org/Add");
objhttp.setRequestHeader("Content-Type", "text/xml");
objhttp.send(request);
//Result in the form of xml like this <Result> 3 </Result>.you should have load this xml string into DOM then Parse as per your req.
var xml = objhttp.ResponseText;
--------------------------------------------------------------------------------------
Wednesday, August 02, 2006
Closing Parent Window.
close the parent window while child window popped out from it.At the same time it should not ask any confirmation from user.
Parent Window should have :
----------------------------
window.open("NewChild.html","name","width=400px, height=400px,resizable=no,scrollbars=no,toolbar=no,status=yes");
window.opener = null;
self.close();
Monday, May 22, 2006
Verbatim Symbol ( @ ) in C#
In C#,Verbatim (@) is the powerful string as ever.
It will take care of escape sequences.
Ex:
If you are going to assign a path value to some string
without verbatim,we need to specify the escape sequences.
string path = "C:\\log\\log.txt"
If we use verbatim,no need to take care of escape sequences.
string path = @"C:\log\log.txt"
It will used to supress the Keyword itself.
Ex:
if you are decalre the class as property name,
C# won't allow this coz of keyword.If you use
the verbatim (@),it is possible to suppress a keyword
public string @class
{
get{};
set{};
}
Thursday, May 18, 2006
Convert Hexadecimal to Decimal
public string HexaToDecmialConversion(string hexvalue)
{
string decmialValue = "";
for(int i=0; i<hexvalue.Length; i+=2)
{
string hex = hexvalue.Substring(i,2);
decmialValue += Int32.Parse
(hex,System.Globalization.NumberStyles.AllowHexSpecifier).ToString();
}
return decmialValue;
}
Wednesday, May 17, 2006
Read the Values from Excel File
DataSet ds = new DataSet();
string connstr = @"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=D:\My.xls;DefaultDir=D:\sankar;";
OdbcConnection conn = new OdbcConnection(connstr);
conn.Open();
OdbcDataAdapter da = new OdbcDataAdapter("select * from [sheet1$]",conn);
da.Fill(ds);
da.Dispose();
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
Friday, November 04, 2005
Site Search Using Windows Catalog Service
string strCatalog = "Test";
string strQuery = "Select Filename,VPath,Path from SCOPE()
where FREETEXT('" + TextBox1.Text + "') ";
string connString = "Provider=MSIDXS;Data Source='" + strCatalog + "'";
OleDbConnection Connection = new OleDbConnection(connString);
Connection.Open();
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, Connection);
DataSet ds = new DataSet();
da.Fill(ds);
Connection.Close();
DataView source= new DataView(ds.Tables[0]);
DataGrid1.DataSource = source;
DataGrid1.DataBind();
XSL Key
you can segregate distinct values using xsl:key from XML
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="Brand-Id" match="//row" use="@BrandId"/>
<xsl:template match="/">
<table cellpadding="4" Id="xsltable" width="70%" align="center">
<tr class="tablecontent2">
<td>
<xsl:apply-templates
select="/Root/row[generate-id()=generate-id(key('Brand-Id',@BrandId)[1])]"
mode="Brand"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="row" mode="Brand">
<xsl:variable name="brandid" select="@BrandId"/>
<xsl:value-of select="/Root/row[@BrandId=$brandid]/@BrandName"/>
</xsl:stylesheet>
Transform XML to HTML Using XSL
Tuesday, October 25, 2005
Useful Suff
How to consume the web.config????
Database connection.
Authentication.
Role based authentication.
If web application doesn't have the web.config for that
particular application,IS it run??
Yes... It wil take from Machine.config.
What about httphandlers???
Diff b/w DataReader and DataAdaptor???
Diff b/w functions and Storedprocedure??
Encapsulation Example
Project Architecture
what about Sealed Class?
How to set the properties in C#??
How to access the properties in C#?
How to create the Shared Assembly ?
What about Assemblyinfo.cs?
Types of Triggers?
CLR Architecture ?
Delegates??? Real Example for Delegates
What is strong Name?
How many non cluster index available in SQL server?
Noncluster index -- 249
Cluster Index -- Only one
What is the Diff b/w Unique and Primary ??
How to create Cluster and Non Cluster index?
How to get the WEbservice through website?
Why we need web service??
How to access the nodes in XML??
What are all the classes used for Data Conncetivity??
I want to prevent the object access to particular class How to acheive it??
What is the main functionality of JIT Compiler??
What is unsafe code ?? Is it managed code or unmanaged code??
What about Boxing and Unboxing ??? Is there any special key word for that??
Diff b/w Protected and Protected Internal
Thursday, October 20, 2005
Monday, October 17, 2005
Array in Javascript
function Product(_headerName, _paramName) {
this.headerName = _headerName;
this.paramName = _paramName;
}
function pop()
{
var arrProduct = new Array();
arrProduct[0] = new Product("Product", "ProductFKID");
arrProduct[1] = new Product("Opening Stock", "OpeningStock");
arrProduct[2] = new Product("Stock Received", "StockReceived");
arrProduct[3] = new Product("Secondary Sale", "SecondarySale");
arrProduct[4] = new Product("Closing Stock", "ClosingStock");
arrProduct[5] = new Product("Stock in Transit", "StockinTransit");
arrProduct[6] = new Product("Damaged Stock", "DamagedStock");
for(var i = 0 ; i < arrProduct.length; i++)
{
alert(arrProduct[i].headerName +'-'+arrProduct[i].paramName);
}
}
Friday, October 14, 2005
Boxing and Unboxing
int i = 5;
object o = i; // Boxing Value ---> Reference (Implicit)
int j = (int)o; // UnBoxing Reference ---> value (Explicit)
MessageBox.Show(j.ToString());
Get the Schema Table
using System;
using System.Data;
using System.Data.SqlClient;
namespace GetSchemaInfo
{
public class TableSchmea
{
string hi;
public string FindMaxLength(string tablename,string fieldname)
{
SqlConnection Conn = new SqlConnection("server=210.210.99.104;database=IndageLive;uid=shaw;pwd=shaw;");
SqlCommand Cmd = new SqlCommand("Select * from "+tablename,Conn);
Conn.Open();
SqlDataReader dr = Cmd.ExecuteReader();
DataTable SchemaTable = dr.GetSchemaTable();
foreach(DataRow drow in SchemaTable.Rows)
{
foreach(DataColumn dcol in SchemaTable.Columns)
{
if(dcol.ColumnName == "ColumnName" && drow[dcol].ToString()== fieldname)
{
hi = dcol.ColumnName +" = "+ drow[dcol] +" "+ "ColumnSize " + "=" + drow["ColumnSize"] ;
}
}
}
//Console.ReadLine();
dr.Close();
Conn.Close();
return hi;
}
}
}
Saturday, October 01, 2005
Dynamic XSLT
<root>
<Table Caption="Name" Field="Name"/>
<Table Caption="Age" Field="Age"/>
<Table Caption="Roll" Field="RollNo"/>
<row PKID="1" Name="sankar" Age="25" />
<row PKID="2" Name="Dinesh" Age="12" />
<row PKID="3" Name="ramu" Age="35" />
<row PKID="4" Name="ramesh" Age="30" />
<row PKID="5" Name="Ambrish" Age="30"/>
</root>
<xsl:stylesheet
version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1" width="80%">
<tr>
<xsl:for-each select="//@Caption">
<td><b><xsl:value-of select="."/></b></td>
</xsl:for-each>
</tr>
<xsl:apply-templates select="root/row"/>
</table>
</xsl:template>
<xsl:template match="row">
<xsl:variable name="node" select="."/>
<tr>
<xsl:for-each select="//@Field">
<xsl:variable name="temp" select="."/>
<td>
<xsl:value-of select="$node/@*[name()=$temp]/."/>
</td>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>
Wednesday, September 28, 2005
Difference between ReadOnly and Constant in C#
If you are using constant value you have intitalize that timeitself,but readonly filed u can initialize that timeitself or else in constructor.
Constant value is assigned in Compile time
readonly value is assigned in Run time
using System;
namespace difference
{
class read
{
public readonly int d = DateTime.Now.Hour;
public const int c = 10;
public read(int x)
{
d = x;
}
public read(int x,int y)
{
d = 12;
}
}
class Class1
{
static void Main(string[] args)
{
read obj = new read(DateTime.Now.Hour);
Console.WriteLine(obj.d);
Console.ReadLine();
}
}
}
Friday, September 23, 2005
Cursor in SQL SERVER
DECLARE country CURSOR FOR SELECT PKID,CountryName FROM countryMaster
OPEN country
FETCH NEXT FROM country
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM country
END
CLOSE country
DEALLOCATE country