ویرایش فیلد پایگاه داده برای کلید و مقدار پیش فرض

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)

Request Validation in ASP.NET

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

ایجاد یک فیلد جدید با مقدار پیش فرض

alter table [table name]

add [new field name] [data type] default [value]


Example:

alter table subscriptionAccount

add [enabled] bit default (0)

بررسی صحت Integer بودن یک عدد در VB.Net

Dim result As Integer


Response.Write(Integer.TryParse(TextBox1.Text, result))

تبدیل کد به هش

FormsAuthentication.HashPasswordForStoringInConfigFile("متنی که باید تبدیل شود", "sha1")

تنظیم دات نت ۴ روی IIS ویندوز ۷

باید روز IIS کلیک راست کنیم و از پنجره Actions گزینه Change .Net Framework Version کلیک و از پنچره باز شده نسخه مناسب رو انتخاب می‌کنیم.


سپس روی Default Web Site کلیک کنید و از پنجره Actions روی گزینه Advance Setting کلیک می‌کنیم. از پنجره باز شده گزینه اول (Application Pool) را به ورژن مورد نظر تغییر دهید.

نحوه نوشتن کدهای HTML در ASP.Net 4.0

در بالای صفحه ایجاد محتوا و یا بروزرسانی محتوا باید از کد زیر استفاده کنیم:


ValidateRequest="false"


در فایل web.config تنظیمات زیر را انجام می‌دهیم:


<httpRuntime requestValidationMode="2.0"/>

<pages validateRequest="false" />  

ترتیب رنگ سیم‌های کابل شبکه

سفید نارنجی
نارنجی
سفید سبز
آبی
سفید آبی
سبز
سفید قهوه‌ای
قهوه‌ای

تبدیل نوع در t-sql

Syntax for CAST:
CAST ( expression AS data_type [ ( length ) ] )

Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

ایجاد و خواندن کوکی در asp.net

Create Cookies
Dim userInfo As HttpCookie = New HttpCookie("userInfo")
userInfo("id") = 1
userInfo("fullname") = "Mostafa Alimohammadi"
Response.Cookies.Add(userInfo)

Read Cookies
If (Request.Cookies("userInfo") IsNot Nothing) Then
If (Request.Cookies("userInfo")("id") IsNot Nothing) Then
lblMsg.Text &= "<p>" & Request.Cookies("userInfo")("id")
lblMsg.Text &= "<p>" & Request.Cookies("userInfo")("fullname")
End If
End If