Posts

Showing posts from February, 2012

Understanding Database Architecture

http://sqlcommunity.com/Videos/DatabaseArchitecture.aspx

Loading user control dynamically .. on page

Control c = (Control)Page.LoadControl("~/usercontrol/MyUserControl.ascx"); Page.Form.Controls.Add(c);

how to get the salary in descending order with out using the keyword desc in sql

Select * from emp order by ((Select max(salary ) from emp) - salary)+1

Parsing XML data in Sql server

--OPENXML parses the XML data in SQL Server in an efficient manner. It’s primary ability is to insert XML data to the RDB. It is also possible to query the data by using OpenXML. --The path of the XML element needs to be specified by using ‘xpath’. --The following is a procedure for retrieving xml data: DECLARE @index int DECLARE @xmlString varchar(8000) SET @xmlString ='<Persons> <Person id="15201"> <Name>Prasanth</Name> <PhoneNo>9343463943</PhoneNo> </Person> <Person id="15202"> <Name>Laasya</Name> <PhoneNo>9342673212</PhoneNo> </Person> </Persons>' EXEC sp_xml_preparedocument @index OUTPUT, @xmlString SELECT * FROM OPENXML (@index, 'Persons/Person')  WITH  (id varchar(10), Name varchar(100) 'Name' , PhoneNo varchar(50) 'PhoneNo') EXEC sp_xml_removedocument @index --The above code snippet results the following: --15201 Prasanth...

How to send email through Sql Server 2008

Management >> Database Email >> Create profile and configure smtp Serevr or you can follow the given Link of Mr Pinaldave .. Step 1 : Create profile and configure smtp Serevr  Step 2 : sp_CONFIGURE 'show advanced' , 1 GO RECONFIGURE GO sp_CONFIGURE 'Database Mail XPs' , 1 GO RECONFIGURE GO Step 3: USE YourDataBase GO EXEC sp_send_dbmail @profile_name = 'Your Profile' , @recipients = ' recipient email ' , @subject = 'Test message' , @body = 'This is the body of the test message. Congrates Database Mail Received By you Successfully.' or Directly right click on Database Mail and you will get sending mail enterface.  

how to use viewstate on other page

viewstate1.aspx <asp:Label ID="Label1" runat="server" Text="first page of label"></asp:Label> protected void Page_Load(object sender, EventArgs e)     {         ViewState["first"] = Label1.Text;         Server.Transfer("viewstate2.aspx");     }     public StateBag ReturnViewState()     {         return ViewState;     } use on viewstate2.aspx.cs page  protected void Page_Load(object sender, EventArgs e)     {         if (PreviousPage != null)         {             Label1.Text = "second page of label = " + PreviousPageViewState["first"].ToString();         }     }    ...

Cross Page Posting

Basically, cross-page posting means that you are posting form data to another page as opposed to posting form data back to the same page (as is the default in ASP.NET). This can be useful when you want to post data to another page and don't want to incur the overhead of reloading the current page simply to redirect the user to another page.   crosspage1.aspx <asp:Label ID="Label1" runat="server" Text="I want to access by crosspage posting"></asp:Label>         <asp:Button ID="Button1" runat="server" Text="crosspage" PostBackUrl="~/crosspage2.aspx" /> crosspage2.aspx   if (PreviousPage != null && PreviousPage.IsCrossPagePostBack != null)         {             Label1.Text = "result of cross page posting : = " + ((Label)PreviousPage.FindControl("Label1")).Text;         }

Instant Payment Notification (IPN) Sample Code

// ASP .NET C# using System; using System.IO; using System.Text; using System.Net; using System.Web; public partial class csIPNexample : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Post back to either sandbox or live string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr"; string strLive = "https://www.paypal.com/cgi-bin/webscr"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox); //Set values for the request back req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength); string strRequest = Encoding.ASCII.GetString(param); strRequest += "&cmd=_notify-validate"; req.ContentLength = strRequest.Length; //for proxy //WebProxy proxy = new WebProxy(new Uri("http://url:port#")); //req.Proxy = proxy; //Send the request to PayPal and get the response StreamWriter streamOu...

How to call paypal server?

<body>     <form name='frmPaypal' action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='Post'>     <input type="hidden" name="cmd" value="_cart" />     <input type="hidden" name="upload" value="1" />     <input type="hidden" name="business" value="6QRDTBF7J9R6E" />     <input type="hidden" name="notify_url" value="notify_url" />     <input type="hidden" name="cancel_return" value="cancel_return url" />     <input type="hidden" name="SessionID" value="oepenmk5nynzalu3w4mi4iej" />     <input type="hidden" name="currency_code" value="USD" />     <input type="hidden" name="return" value="return url" />     <input type="hidden" name="lc...