public static Boolean WriteTextFile(string content, string filepath,string name)
{
FileStream fs;
StreamWriter sw;
if (!System.IO.Directory.Exists(filepath))
{
DirectoryInfo DirInfo = Directory.CreateDirectory(filepath); //´´½¨Ä¿Â¼
DirInfo.Attributes = FileAttributes.Normal;
}
string fullpath = filepath + name + ".txt";
if (File.Exists(fullpath))//ÑéÖ¤ÎļþÊÇ·ñ´æÔÚ
{
return false;
}
else
{
fs = new FileStream(fullpath, FileMode.Create, FileAccess.Write);
sw = new StreamWriter(fs,System.Text.Encoding.Default);
sw.WriteLine(content);
sw.Close();
fs.Close();
return true;
}
}
ÔÚ×öÕâ¸öÏà¹Ø¹¤×÷µÄʱºò »¹Åöµ½Ò»¸öÎÊÌâ¾ÍÊÇ ÓÃһϷ½·¨¶ÁÈ¡ÖÐÎÄÎı¾Îļþʱ£¬³öÏÖÂÒÂëµÄÏÖÏó£º
public static String ReadTextFile(string fi ......
Label——height£º¸ß¶È
width£º¿í¶È
backcolor£º±³¾°É«
forecolor£ºÇ°¾°É«
bordercolor£º±ß¿òÉ«
borderstyle£º±ß¿òÑùʽ
bordersize£º±ß¿ò´óС
font£º×ÖÌå
text£ºlabelÉϵÄÎÄ×Ö
visible£ºÊÇ·ñ¿É¼û
  ......
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£ protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£ public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£ internal: ÔÚͬһÃüÃû¿Õ¼äÄÚ¿ÉÒÔ·ÃÎÊ¡£2 .ÁоÙASP.NET Ò³ÃæÖ®¼ä´«µÝÖµµÄ¼¸ÖÖ·½Ê½¡£ ´ð. 1.ʹÓà QueryString, Èç....?id=1; response. Redirect().... 2.ʹÓà Session ±äÁ¿ 3.ʹÓà Server.Transfer3. Ò»ÁÐÊýµÄ¹æÔòÈçÏÂ: 1¡¢1¡¢2¡¢3¡¢5¡¢8¡¢13¡¢21¡¢34...... ÇóµÚ30λÊýÊǶàÉÙ£¬ÓõݹéË㷨ʵÏÖ¡£´ð£º
public class MainClass {
public static void Main() {
Console.WriteLine(Foo(30));
}
public static int Foo(int i){
if (i return 0; else if(i > 0 && i return 1; else return Foo(i -1) + Foo(i - 2);
}
}
4.C#ÖеÄίÍÐÊÇʲô£¿Ê¼þÊDz»ÊÇÒ»ÖÖίÍУ¿´ð £º ίÍпÉÒÔ°ÑÒ»¸ö·½·¨×÷Ϊ²ÎÊý´úÈëÁíÒ»¸ö·½·¨¡£Î¯ÍпÉÒÔÀí½âΪָÏòÒ»¸öº¯ÊýµÄÒýÓá£ÊÇ£¬ÊÇÒ»ÖÖÌØÊâµÄίÍÐ5.override ÓëÖØÔØµÄÇø±ð´ð £ºoverride ÓëÖØÔØµÄÇø±ð¡£ÖØÔØÊÇ·½·¨µÄÃû³ÆÏàͬ¡£²ÎÊý»ò²ÎÊýÀàÐͲ»Í¬£¬½øÐжà´ÎÖØÔØÒÔÊÊÓ¦ ......
The C# classes that you design will be used by code that you write and possibly by code that
other people write. Your C# classes may be used by a VB.NET application or from within an
ASP.NET page. Moreover, your classes may very well be used alongside other classes
designed by other .NET developers.
Code written in a .NET language references classes by their names, and all of these classes
used together suggests an obvious dilemma: What happens if a developer wants to use two
classes that have the same name?
Suppose you write a C# class that reads records from a database and you name the class
Recordset. Code that wants to use your class may create objects as follows:
Recordset MyRecordset = new Recordset();
Now suppose that you package your classes into a .NET assembly and distribute your
assembly for use by other applications. Furthermore, suppose that someone obtains your
assembly and integrates it into his or her application. What happens if that same application
also ......
The C# classes that you design will be used by code that you write and possibly by code that
other people write. Your C# classes may be used by a VB.NET application or from within an
ASP.NET page. Moreover, your classes may very well be used alongside other classes
designed by other .NET developers.
Code written in a .NET language references classes by their names, and all of these classes
used together suggests an obvious dilemma: What happens if a developer wants to use two
classes that have the same name?
Suppose you write a C# class that reads records from a database and you name the class
Recordset. Code that wants to use your class may create objects as follows:
Recordset MyRecordset = new Recordset();
Now suppose that you package your classes into a .NET assembly and distribute your
assembly for use by other applications. Furthermore, suppose that someone obtains your
assembly and integrates it into his or her application. What happens if that same application
also ......
WebRequest mywebrq;
WebResponse mywebresp;
StreamReader sr;
Streamwriter sw;
Private void Page_Load(object sender,EventArgs e) { mywebreq=WebRequest.Create( http://localhost/Test.aspx ); mywebresp=mywebreq.GetResponse();
sr=new streamReader(mywebresp.GetResponsestream());
strHtml=sr.ReadToEnd();
sw=File.CreateText(server.mappath("Test.htm"));
sw.writeling(strHtml);
sw.close();
Response.writeFile(Server.Mappath("Test.htm"));
} ......
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯¡¡
¡¡¡¡Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
¡¡¡¡·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø±ÕʱÊÕ»ØÁ¬½Ó£¬µÈ´ýÏÂÒ»´ÎµÄÁ¬½ÓÇëÇó¡£Á¬½Ó³ØµÄ´óСÊÇÓÐÏ޵ģ¬Èç¹ûÔÚÁ¬½Ó³Ø´ïµ½×î´óÏ޶ȺóÈÔÒªÇó´´½¨Á¬½Ó£¬±ØÈ»´ó´óÓ°ÏìÐÔÄÜ¡£Òò´Ë£¬ÔÚ½¨Á¢Êý¾Ý¿âÁ¬½ÓºóÖ»ÓÐÔÚÕæÕýÐèÒª²Ù×÷ʱ²Å´ò¿ªÁ¬½Ó£¬Ê¹ÓÃÍê±ÏºóÂíÉϹرգ¬´Ó¶ø¾¡Á¿¼õÉÙÊý¾Ý¿âÁ¬½Ó´ò¿ªµÄʱ¼ä£¬±ÜÃâ³öÏÖ³¬³öÁ¬½ÓÏÞÖÆµÄÇé¿ö¡£ ¡¡¡¡
¡¡¡¡Ê¹Óô洢¹ý³Ì¡¡
¡¡¡¡´æ´¢¹ý³ÌÊÇ´æ´¢ÔÚ·þÎñÆ÷ÉϵÄÒ»×éÔ¤±àÒëµÄSQLÓï¾ä£¬ÀàËÆÓÚDOSϵͳÖеÄÅú´¦ÀíÎļþ¡£´æ´¢¹ý³Ì¾ßÓжÔÊý¾Ý¿âÁ¢¼´·ÃÎʵŦÄÜ£¬ÐÅÏ¢´¦Àí¼«ÎªÑ¸ËÙ¡£Ê¹Óô洢¹ý³Ì¿ÉÒÔ±ÜÃâ¶ÔÃüÁîµÄ¶à´Î±àÒ룬ÔÚÖ´ÐÐÒ»´ÎºóÆäÖ´Ðй滮¾ÍפÁôÔÚ¸ßËÙ»º´æÖУ¬ÒÔºóÐèҪʱֻÐèÖ±½Óµ÷Óûº´æÖеĶþ½øÖÆ´úÂë¼´¿É¡£ÁíÍ⣬´æ´¢¹ý³ÌÔÚ·þÎñÆ÷¶ËÔËÐУ¬¶ÀÁ¢ÓÚASP.NET³ÌÐò£¬±ãÓÚÐ޸ģ¬×îÖØÒªµÄÊÇËü¿ÉÒÔ¼õÉÙÊý¾Ý¿â²Ù×÷Óï¾äÔÚÍøÂçÖеĴ«Êä¡£
¡¡¡¡ÓÅ»¯²éѯÓï¾ä
¡¡¡¡¡¡
¡¡¡¡ASP.NETÖÐADOÁ¬½ÓÏ ......