Pages

Featured Posts

Tuesday, 10 April 2012

How to get data from sql server in asp.net c sharp

Add following namespace  in your cs page
using System.Data.SqlClient;


 string connstring = "Your Connection String Here";
 SqlConnection cn = new SqlConnection(connstring);
 cn.Open()
SqlCommand cmd=new SqlCommand(Youe Query Here, cn);
cmd.Execute();
cn.Close();

Thursday, 8 September 2011

How Get Gmail Addresses in your c sharp asp.net Application

Get your email address in asp.net application.
Step 1> Create New Asp.Net application.
Step 2 > First Add the Google Data API  in your project show follows.
code
1
2
3
4
using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.Contacts;
using Google.GData.Contacts;using Google.GData.Client;using Google.GData.Extensions;using

Step 3 >Then Add 2 TextBox , one ListBox and one button in your page.
                   textBox1 for Email ID
                  textBox2 for Password
                  ListBox1 for display Email Address.
Step 4 > Write or Past following code in button click event.

rs.AutoPaging =



{

ListBox1.Items.Add(c.Title);

{

ListBox1.Items.Add(
}
}
RequestSettings rs = new RequestSettings("", TextBox1.Text, TextBox2.Text);true;ContactsRequest cr = new ContactsRequest(rs);Feed<Contact> feed = cr.GetContacts();foreach (Contact c in feed.Entries)Debug.WriteLine("\t" + c.Title);foreach (EMail email in c.Emails)Debug.WriteLine("\t" + email.Address);" " + email.Address);
code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
RequestSettings rs = new RequestSettings("", TextBox1.Text, TextBox2.Text);
           rs.AutoPaging = true;
           ContactsRequest cr = new ContactsRequest(rs);
           Feed<Contact> feed = cr.GetContacts();
           foreach (Contact c in feed.Entries)
           {
               Debug.WriteLine("\t" + c.Title);
               ListBox1.Items.Add(c.Title);
               foreach (EMail email in c.Emails)
               {
                   Debug.WriteLine("\t" + email.Address);
                   ListBox1.Items.Add("  " + email.Address);
               }
           }
Google.Contacts; 

Tuesday, 30 August 2011

All About Session

Introduction
First of all I would like to thank all the readers who read and vote for my article. In Beginner's Guide series, I have written some articles on state management. Probably this is my last article on state management. Now coming back to the topic of this article "Exploring Session in ASP.Net" . This article will give you a very good understanding of session. In this article I have covered basic of session, different types of storing session object, Session behavior in web farm scenarios , Session on Load Balancer etc. I have also explained details of Session Behavior in a Live production environment. Hope you will enjoy this article and provide your valuable suggestion and feedback.
 
What is Session ?
Web is Stateless, which means a new instance of the web page class is re-created each time the page is posted to the server. As we all know HTTP is a stateless protocol, it can't hold the client information on page. If user inserts some information, and move to the next page, that data will be lost and user would not able to retrieve the information. So what we need? we need to store information. Session provides that facility to store information on server memory. It can support any type of object to store along with our custom object. For every client Session data store separately, means session data is stored as per client basis. Have a look at the following diagram.