tableA från databasen databaseB till databaseA:
drop table databaseA.dbo.tableA
select * into databaseA.dbo.tableA from databaseB.dbo.tableA
En blogg, kanske mest för eget bruk, för att hålla koll på alla små programmeringskoder som kan vara bra att ha lättillgängligt.
tableA från databasen databaseB till databaseA:
drop table databaseA.dbo.tableA
select * into databaseA.dbo.tableA from databaseB.dbo.tableA
string str= "Texten har <b>{0}</b> ord";
string output = String.Format(str, "fyra");
<?php
ini_set('display_errors', '0');
?><?php
ini_set('display_errors', '1');
?>
C# Type .Net type Signed? Bytes Possible Values sbyte System.Sbyte Yes 1 -128 to 127 short System.Int16 Yes 2 -32768 to 32767 int System.Int32 Yes 4 -2147483648 to 2147483647 long System.Int64 Yes 8 -9223372036854775808 to 9223372036854775807 byte System.Byte No 1 0 to 255 ushort System.Uint16 No 2 0 to 65535 uint System.UInt32 No 4 0 to 4294967295 ulong System.Uint64 No 8 0 to 18446744073709551615 float System.Single Yes 4 Approximately ±1.5 x 10-45 to ±3.4 x 1038 with 7 significant figures double System.Double Yes 8 Approximately ±5.0 x 10-324 to ±1.7 x 10308 with 15 or 16 significant figures decimal System.Decimal Yes 12 Approximately ±1.0 x 10-28 to ±7.9 x 1028 with 28 or 29 significant figures char System.Char N/A 2 Any Unicode character (16 bit) bool System.Boolean N/A 1 / 2 true or false
<appSettings>
<add key = "MyValue" value="12345" />
</appSettings>using System.Configuration;
...
String str = ConfigurationManager.AppSettings["MyValue"];
using System.Diagnostics;
...
Stopwatch sw = Stopwatch.StartNew();
//Code here
String.Format("It took {0} seconds.", sw.Elapsed.TotalSeconds);
| Request.ApplicationPath: | /Homepage |
| Request.CurrentExecutionFilePath: | /Homepage/Temp/Test.aspx |
| Request.FilePath: | /Homepage/Temp/Test.aspx |
| Request.Path: | /Homepage/Temp/Test.aspx |
| Request.PathInfo: | |
| Request.PhysicalApplicationPath: | D:\Inetpub\wwwroot\CambiaWeb\Homepage\ |
| Request.QueryString: | /Homepage/Temp/Test.aspx?query=arg |
| Request.Url.AbsolutePath: | /Homepage/Temp/Test.aspx |
| Request.Url.AbsoluteUri: | http://localhost:80/Homepage/Temp/Test.aspx?query=arg |
| Request.Url.Fragment: | |
| Request.Url.Host: | localhost |
| Request.Url.Authority: | localhost:80 |
| Request.Url.LocalPath: | /Homepage/Temp/Test.aspx |
| Request.Url.PathAndQuery: | /Homepage/Temp/Test.aspx?query=arg |
| Request.Url.Port: | 96 |
| Request.Url.Query: | ?query=arg |
| Request.Url.Scheme: | http |
| Request.Url.Segments: | / Homepage/ Temp/ Test.aspx |
| Request.ApplicationPath: | /Homepage |
| Request.CurrentExecutionFilePath: | /Homepage/Temp/Test.aspx |
| Request.FilePath: | /Homepage/Temp/Test.aspx |
| Request.Path: | /Homepage/Temp/Test.aspx/path/info |
| Request.PathInfo: | /path/info |
| Request.PhysicalApplicationPath: | D:\Inetpub\wwwroot\CambiaWeb\Homepage\ |
| Request.QueryString: | /Homepage/Temp/Test.aspx/path/info?query=arg |
| Request.Url.AbsolutePath: | /Homepage/Temp/Test.aspx/path/info |
| Request.Url.AbsoluteUri: | http://localhost:80/Homepage/Temp/Test.aspx/path/info?query=arg |
| Request.Url.Fragment: | |
| Request.Url.Host: | localhost |
| Request.Url.LocalPath: | /Homepage/Temp/Test.aspx/path/info |
| Request.Url.PathAndQuery: | /Homepage/Temp/Test.aspx/path/info?query=arg |
| Request.Url.Port: | 96 |
| Request.Url.Query: | ?query=arg |
| Request.Url.Scheme: | http |
| Request.Url.Segments: | / Homepage/ Temp/ Test.aspx/ path/ info |
Response.Redirect(Request.RawUrl);
str.PadLeft(4,'0');Random RandomClass = new Random();
string rnd = RandomClass.Next(1, 10000).ToString();
DateTime date = new DateTime();
date = DateTime.Now;
date.ToString("yyyy-MM dd");| Format | Exempel |
|---|---|
| d | 8 (dag 8 i månaden) |
| dd | 08 (en nolla före) |
| ddd | tis (förkortning på veckodagen) |
| dddd | (tisdag) |
| M | 2 (månad 2 på året) |
| MM | 02 (en nolla före) |
| MMM | feb (förkortning för månaden) |
| MMMM | februari |
| y | 5 (årtal utan årtusendet) |
| yy | 05 (årtal utan årtusendet, om årtalet är mindre än 10 skrivs en nolla ut framför) |
| yyyy | 2005 |
| gg | A.D. (Anno Domini, tidsåldern vi befinner oss i) |
| hh | 11 (timslaget i 12-timmarsintervall) |
| HH | 23 (timslaget i 24-timmarsintervall) |
| mm | 12 (minut under en timme) |
| ss | 36 (sekund under en minut) |
| f | (tiondel av en sekund, använd ”s f” som formatmönstret) |
| ff | (hundradel av en sekund, använd ”s ff” som formatmönstret) |
| fff | (tusendel av en sekund, använd ”s fff” som formatmönster) |
| (finns i upp till sex decimaler) | |
| tt | PM (om exempelvis en-GB, Storbritanniens datumstandard används. AM eller PM) |
| zz | +01 (vår tidszonskompensation) |
| : | standardseparatorn för tid (22:12) |
| / | standardseparatorn för datum (8/2) |
| % c | (används om man vill skriva ett extra formatmönster i formatmönstret.) |
| \ c | (används om man vill skriva text och inte mönster, i formatmönstret, exempelvis \kl HH:mm för att skriva kl 22:12) |
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />