Function createMenu() As String
Dim ds As New DataSet()
Dim cn As New SqlConnection(DB.connectionStirng.ConnectionString())
Dim cmd As New SqlCommand("SELECT * FROM content order by sort asc", cn)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
Dim table As DataTable = ds.Tables(0)
Dim parentMenus As DataRow() = table.Select("[parent]=1")
Dim sb = New StringBuilder()
Dim unorderedList As String = GenerateUL(parentMenus, table, sb)
Return (unorderedList)
End Function
Private Function GenerateUL(ByVal menu As DataRow(), ByVal table As DataTable, ByVal sb As StringBuilder) As String
sb.AppendLine("<ul>")
If menu.Length > 0 Then
For Each dr As DataRow In menu
Dim menuText As String = dr("title").ToString()
Dim line As String = [String].Format("<li><a href=#>{0}</a>", menuText)
sb.AppendLine(line)
Dim pid As String = dr("id").ToString()
Dim subMenu As DataRow() = table.Select("[parent]=" & pid)
If subMenu.Length > 0 Then
Dim subMenuBuilder = New StringBuilder()
sb.AppendLine(GenerateUL(subMenu, table, subMenuBuilder))
End If
sb.AppendLine("</li>")
Next
End If
sb.Append("</ul>")
Return sb.ToString()
End Function
Server Name | SMTP Address | Port | SSL |
Yahoo! | smtp.mail.yahoo.com | 587 | Yes |
GMail | smtp.gmail.com | 587 | Yes |
Hotmail | smtp.live.com | 587 | Yes |
using System.Net;using System.Net.Mail;
string smtpAddress = "smtp.mail.yahoo.com";int portNumber = 587;bool enableSSL = true;
string emailFrom = "email@yahoo.com";string password = "abcdefg";string emailTo = "someone@domain.com";string subject = "Hello";string body = "Hello, I'm just writing this to say Hi!";
using (MailMessage mail = new MailMessage()) mail.From = new MailAddress(emailFrom);{ mail.To.Add(emailTo); mail.Subject = subject; mail.Body = body; mail.IsBodyHtml = true; // Can set to false, if you are sending pure text.
mail.Attachments.Add(new Attachment("C:\\SomeFile.txt")); mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));
using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, password); smtp.EnableSsl = enableSSL;} smtp.Send(mail); }
select ID, title from software where ID IN(
select top 10 ID from software where ID IN(
select top 10 ID from software order by ID)
order by id desc)
order by id
**********************************************************
select top 10 * from software where id in(
select top 10 id from software where id IN(
select top 70 id from software order by id desc)
order by id asc)
order by id desc
DROP TABLE table_name
EXEC sp_rename 'Current Name', 'New Name';
منبع:
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
منبع:
alter table [tableName]
add [fieldName] int identity(1,1)
alter table [tableName]
ADD PRIMARY KEY ([fieldName])
Expamle:
alter table attachment
add id int identity(1,1)
alter table attachment
ADD PRIMARY KEY (id)
Disabling Request Validation in ASP.NET Web Forms (ASP.NET 4 or later)
configuration
system.web
httpRuntime requestValidationMode="2.0" /
pages validateRequest="false" /
/system.web
/configuration