C#ÖеÄString.Format·½·¨
Ò»¡¢¶¨Òå
String.FormatÊǽ«Ö¸¶¨µÄ StringÀàÐ͵ÄÊý¾ÝÖеÄÿ¸ö¸ñʽÏîÌ滻ΪÏàÓ¦¶ÔÏóµÄÖµµÄÎı¾µÈЧÏî¡£
Èç:
£¨1£©
string p1 = "Jackie";
string p2 = "Aillo";
Response.Write(String.Format("Hello {0}, I'm {1}", p1, p2));
£¨2£©
Response.Write(String.Format("Hello {0}, I'm {1}", "Jackie", "Aillo"));
Õâ¶þÕßµÄЧ¹ûÊÇÒ»ÑùµÄ¡£¶¼Êǽ«×îºóÃæµÄÁ½ÏîµÄÖµ·Ö±ðÌæ»»µÚÒ»ÏîµÄ{0}ºÍ{1}¡£
Êä³öµÄ½á¹ûÊÇ£ºHello Jackie, I'm Aillo
¶þ¡¢String.FormatµÄ¶à¸ñʽ¶¨Ò壺
ÕâÀïËùνµÄ¶à¸ñʽÊÇÖ¸Ò»¸ö¸ñʽÏîÖпÉÒÔ¶¨Òå1~3¸ö¸ñʽ²ÎÊý£¬Ã¿ÖÖ¸ñʽ²ÎÊýÓ÷ֺţ¨£»£©¸ô¿ª¡£´ø2¸öºÍ3¸ö¸ñʽ²ÎÊýµÄ¸ñʽÏîËù¶ÔÓ¦µÄÖµ±ØÐëÊÇÊýÖµÀàÐ͵ģ¬ÕâÑù²ÅÄÜÅжÏÊÇ·ñΪ¸ºÊý¡¢ÕýÊý¡¢Áã¡£
´ø1¸ö¸ñʽ²ÎÊý£º
//ÒÔ¿Æѧ¼ÆÊý·¨µÄ¸ñʽÊä³ö
double p1 = 1000000;
Response.Write(String.Format("{0:E2}", p1));
´ø2¸ö¸ñʽ²ÎÊý£º
/*µ±¸ñʽÏî¶ÔÓ¦µÄֵΪ·Ç¸ºÊý£¬ÔòÑ¡ÔñµÚÒ»ÖÖ¸ñʽ£»ÖµÎª¸ºÊýÔòÑ¡µÚ¶þÖÖ¸ñʽ*/
double p1 = 10000;
double p2 = -2420.50;
Response.Write(String.Format("{0:#,###0.00;#,###0.000;}<BR>", p1));
Response.Write(String.Format("{0:#,###0.00;#,###0.000;}", p2));
´ø3¸ö¸ñʽ²ÎÊý£º
/*µ±¸ñʽÏî¶ÔÓ¦µÄֵΪÕýÊýÔòÑ¡ÔñµÚÒ»ÕŸñʽ£»
¸ºÊýÔòΪµÚ¶þÖиñʽ£»
ÖµµÈÓÚÁãÔòΪµÚÈýÖÖ¸ñʽ*/
1double p1 = 10000;
double p2 = -2420.50;
double p3 = 0.00;
Response.Write(String.Format("{0:#,###0.00;#,###0.000;#,###0.0000}<BR>", p1));
Response.Write(String.Format("{0:#,###0.00;#,###0.000;#,###0.0000}<BR>", p3));
Response.Write(String.Format("{0:#,###0.00;#,###0.000;#,###0.0000}", p2));
²¹³ä£º
{0:N2} ÖеÄN3,f3±íʾ¸ñʽ»¯Ö®ºóÊý¾ÝµÄÀàÐÍÒÔ¼°Ð¡ÊýµÄλÊý¡£È磺N2±íʾ´ø2¸öСÊýµÄÊý×Ö£»
Óë´ËÀàËÆ£º
N»òÕßn ±íʾ Êý×Ö
F»òÕßf ±íʾ ¹Ì¶¨µã
E»òÕße ±íʾ ¿Æѧ¼ÆÊý·¨
D»òÕßd ±íʾ Ê®½øÖÆÊý
X»òÕßx ±íʾ Ê®Áù½øÖÆ
G»òÕßg ±íʾ ³£¹æ
C»òÕßc ±íʾ »õ±Ò
----------------------------------------------------------------------------------------------------
Ïà¹ØÎĵµ£º
http://www.knowsky.com/5723.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
......
Ó¦ÓóÌÐò£¬´°ÌåÀïÍÏ·ÅÒ»¸öTreeView¿Ø¼þ£¬Ïë°ÑÊý¾Ý¿âÀïµÄÊý¾ÝÔÚÕâ¸ö¿Ø¼þÀïÏÔʾ³öÀ´
TREEVIEW¿Ø¼þÊÇWinfrom´°ÌåÀïµÄ ²»ÊÇASP£®NETÀïµÄTREEVIEW
´úÂëÈçÏ£º
CREATE TABLE CateTable (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[CateName] [nv ......
C#ʹÓÃSQLiteÊý¾Ý¿â(asp.net/winform)
2009Äê1ÔÂ7ÈÕ
ÆÀÂÛ
·¢±íÆÀÂÛ
SQLite
ÊÇÄ¿Ç°±È½ÏÁ÷ÐеÄÒ»¸ö¿ªÔ´¡¢Ãâ·ÑµÄСÐ͵ÄEmbeddable RDBMS(¹ØϵÐÍÊý¾Ý¿â)£¬ÓÃCʵÏÖ£¬ÄÚ´æÕ¼ÓýÏС£¬Ö§³Ö¾ø´óÊýµÄSQL92±ê×¼£¬¸ö±ð²»Ö§³ÖµÄÇé¿ö£¬ÔÚÕâÀï
˵Ã÷
¶Ô¸÷ÖÖÓïÑÔµÄÖ§³ÖÒ²±È½Ï²»´í£¬wrapperºÜ¶à¡ ......
ÏÂÃæÊÇcommond:
MySQLCommand cmd;
cmd = new MySQLDriverCS.MySQLCommand("DROP TABLE IF EXISTS test.mysqldrivercs_test",conn);
cmd.ExecuteNonQuery();
cmd.Dispose();
ÏÂÃæÊÇinsert:
string Value = "Value";
int SettingID = 1;
new MySQLInsertCommand(conn,
new object[,] {{"SettingID",SettingID},{"S ......
VB
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = i1
MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeBinary
MSComm1.InBufferCount = 0
& ......