Pages

Thursday, 16 August 2012

Difference Between Sql Server VARCHAR and NVARCHAR Data Type


Difference Between Sql Server VARCHAR and NVARCHAR Data Type





The abbreviation for Varchar is non-Unicode Variable Length character String.

* The abbreviation of NVarchar is Unicode Variable Length character String. 

Differences :

Character Data Type
Varchar - Non-Unicode Data 
NVarchar - Unicode Data

2 Character Size 
Varchar - 1 byte
NVarchar - 2 bytes

3 Maximum Length 
Varchar - 8,000 bytes
NVarchar - 4,000 bytes

4 Storage Size 
Varchar - Actual Length (in bytes)
NVarchar - 2 times Actual Length (in bytes)



Difference between Sql Server Char and Varchar Data Type


Difference between Sql Server Char and Varchar Data Type



CHAR Data Type is a Fixed Length Data Type.
 For example if you declare a variable/column of CHAR (10) data type, then it will always take 10 bytes irrespective of whether you are storing 1 character or 10 character in this variable or column. And in this example as we have declared this variable/column as CHAR(10), so we can store max 10 characters in this column.

On the other hand VARCHAR is a variable length Data Type.
 For example if you declare a variable/column of VARCHAR (10) data type, it will take the no. of bytes equal to the number of characters stored in this column. So, in this variable/column if you are storing only one character then it will take only one byte and if we are storing 10 characters then it will take 10 bytes. And in this example as we have declared this variable/column as VARCHAR (10), so we can store max 10 characters in this column.

Tuesday, 17 July 2012

How to sent mail in ASP .Net ?

How to sent mail in ASP .Net

--use the following namespaces :

using System.Net.Mail;
using System.Net;

**********************************************

--Call the mathod on the button click :
SendMail();

***********************************************

--defination of the method :

private void SendMail() //string body, string msgto, string msgfrom, string sub, string cpcc)
{
System.Text.StringBuilder msg = new System.Text.StringBuilder();
msg.Append("<table style='font-family:Calibri'>");
msg.Append("<tr><td align='left'>Dear " + txtFirstName.Text + ",<br/></td></tr>");
msg.Append("<tr><td><p>you have been successfully registered.</p></td></tr><br/>");
msg.Append("<tr><td><p>Login Details:</p></td></tr><br/>");
msg.Append("<tr><td><p>User Id: " + txtMobileNumber.Text + " and Password: " + txtPassword.Text + "</p></td></tr><br/>");
msg.Append("<tr><td><p>Thanks & Regards,</p></td></tr>");
msg.Append("<tr><td><p>CommSoft E-Services Pvt. Ltd.</p></td></tr>");
msg.Append("</table>");

string To = txtEmail.Text;
string From = "no-reply";

string Subject = "*** Confirmation Registration  ***";

System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
MailMessage message = new MailMessage();
//message.CC.Add(new MailAddress(cc));
message.Body = Convert.ToString(msg);
message.IsBodyHtml = true;
message.To.Add(To);
message.From = new MailAddress(From);
message.Subject = Subject;
message.Priority = MailPriority.High;

SmtpClient SmtpMail = new SmtpClient();
{
SmtpMail.Host = "smtp.gmail.com";
SmtpMail.Port = 4543;
SmtpMail.EnableSsl = true;
SmtpMail.UseDefaultCredentials = true;
SmtpMail.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
SmtpMail.Credentials = new System.Net.NetworkCredential("no-reply", "4545345");
SmtpMail.Send(message);
}

message.Attachments.Dispose();
}
}
}

Tuesday, 19 June 2012

Add years(data) in Dropdownlist in .cs page

Add years(data) in Dropdownlist in .cs page


#region BINDYEAR

    private void BINDYEAR()
    {
        try
        {
            int A = 1930;
            for (int i = 0; i < 64; i++)
            {
                ListItem LI = new ListItem();
                LI.Text = Convert.ToInt16(A).ToString();
                LI.Value = A.ToString();
                A = A + 1;
                DropDownList1.Items.Add(LI);
            }
            DropDownList1.Items.Insert(0, "YYYY");

        }
        catch (Exception errmsg)
        {
            Response.Write(errmsg.Message.ToString());
        }
    }
    #endregion

Short cut key in asp.net


Short cut key in asp.net

File
1. New Project (Ctrl+Shift+N )
2. Open Project/Solution (Ctrl+Shift+O)
3. Open File (Ctrl+O)
4. Save (Ctrl+S)
5. Save As (Ctrl+Shift+S)
6. Print (Ctrl+P)
 
Edit
7. Undo (Ctrl+Z)
8. Redo (Ctrl+Y)
 
9. Cut (Ctrl+X)
10. Copy (Ctrl+C)
11. Paste (Ctrl+V)
12. Cycle Clipboard Ring (Ctrl+Shift+V)
13. Select All (Ctrl+A)
14. Quick Find (Ctrl+F)
 
15. Quick Replace (Ctrl+H)
16. Find in Files (Ctrl+Shift+F)
17. Replace in Files (Ctrl+Shift+H)
18. Find Symbol (Alt+F12)
 
19. Format Document (Ctrl+E,D)
20. Format Selection (Ctrl+E,F)
21. Make Uppercase (Ctrl+Shift+U)
22. Make Lowercase (Ctrl+U)
23. Delete Horizontal White Space (Ctrl+E, \)
24. View White Space (Ctrl+E,S)
25. Word Wrap (Ctrl+E,W)
26. Incremental Search (Ctrl+I)
27. Comment Selection (Ctrl+E,C)
28. Uncomment Selection (Ctrl+E,U)
 
29. Toggle Bookmark (Ctrl+B,T)
30. Enable Bookmark (Ctrl+B,E)
31. Previous Bookmark (Ctrl+B,P)
32. Next Bookmark (Ctrl+B, N)
33. Clear Bookmarks (Ctrl+B,C)
34. Add Task List Shortcut (Ctrl+E,T)
 
35. Hide Selection (Ctrl+M, Ctrl+H)
36. Toggle Outlining Expansion (Ctrl+M,M)
37. Toggle All Outlining (Ctrl+M,L)
38. Stop Outlining (Ctrl+M,P)
39. Stop Hiding Current (Ctrl+M, Ctrl+U)
 
40. Generate Method Stub (Ctrl+K,M)
41. List Members (Ctrl+K,L)
42. Parameter Info (Ctrl+K,P)
43. Complete Word (Ctrl+K,W)
44. Insert Snippet (Ctrl+K,X)
45. Surround With (Ctrl+K,S)
 
View
46. Code (F7)
47. Designer (Shift+F7)
48. Server Explorer (Ctrl+W,L)
49. Class View (Ctrl+W,C)
50. Code Definition Window (Ctrl+W,D)
51. Object Browser (Ctrl+W,J)
52. Error List (Ctrl+W,E)
53. Output (Ctrl+W,O)
54. Properties Window (Ctrl+W,P)
55. Task List (Ctrl+W,T)
56. Toolbox (Ctrl+W,X)
 
57. Find Symbol Results (Ctrl+W,Q)
58. Bookmark Window (Ctrl+W,B)
59. Command Window (Ctrl+W,A)
60. Document Outline (Ctrl+W,U)
61. Resource View (Ctrl+W,R)
62. Macro Explorer (Alt+F8)
63. Web Browser (Ctrl+W,W)
 
64. Full Screen (Shift+Alt+Enter)
65. Pending Checkins (Ctrl+W,G)
66. Navigate Backward (Ctrl+-)
67. Navigate Forward (Ctrl+Shift+-)
68. Property Pages (Shift+F4)
 
Refactor
69. Rename (F2)
70. Extract Method (Ctrl+R,M)
71. Encapsulate Field (Ctrl+R,E)
72. Promote Local Variable to Parameter (Ctrl+R,P)
73. Remove Parameters (Ctrl+R,V)
74. Reorder parameters (Ctrl+R,O)
 
Website
75. Add New Item (Ctrl+Shift+A)
76. Add Existing Item (Shift+Alt+A)
 
Build
77. Build Solution (F6)
78. Build Web Site (Shift+F6)
 
Debug
79. Breakpoints (Ctrl+D,B)
80. Immediate (Ctrl+D,I)
 
81. Start Debugging (F5)
82. Start without Debugging (Ctrl+F5)
83. Exceptions (Ctrl+D,E)
84. Step Into (F11)
85. Step Over (F10)
86. Break at Function (Ctrl+D,N)
87. Delete All Breakpoints (Ctrl+Shift+F9)
 
Tools
88. Attach to Process (Ctrl+Alt+P)
89. Code Snippets Manager (Ctrl+K, Ctrl+B)
 
90. Run TemporaryMacro (Ctrl+Shift+P)
91. Record TemporaryMacro (Ctrl+Shift+R)
 
92. Macro Explorer (Alt+F8)
93. Macros IDE (Alt+F11)
 
Help
94. How Do I (Ctrl+F1,H)
95. Search (Ctrl+F1,S)
96. Contents (Ctrl+F1,C)
97. Index (Ctrl+F1,I)
98. Help Favourites (Ctrl+F1,F)
99. Dynamic Help (Ctrl+F1,D)
100. Index Results (Ctrl+F1,T)