ASP.NET??using???÷?????
???????????????? ???????[ 2010/7/15 11:16:44 ] ????????
????ASP.NET??using???÷?1.using??using + ???????????????????????????????????????е????????????????????????????????????Java??import????????????????????????cs????????????
???????磺using System;
????using System.Data;
????ASP.NET??using???÷?2.using????????????Χ?????Χ????????????
??????????
???????????????????????????????????????????????????????????????????????????????Dispose??
???????????????????try...catch???????????????????using??????
???????磺
public static DataTable GetTable(string sql?? int executeTimeOut?? string connStringName)
{
????DataTable dtRet = new DataTable();
????using (SqlConnection sc = new SqlConnection(connStringName))
????{
????????using (SqlDataAdapter sqa = new SqlDataAdapter(sql?? sc))
????????{
????????????sqa.SelectCommand.CommandTimeout = executeTimeOut;
????????????sqa.Fill(dtRet);
????????????return dtRet;
????????}
????}
}
????ASP.NET??using???÷?3.using??????using + ???? = ????????????????????????????
?????????????и???????????cs??????????????????????????????????????????????????????????????????????????????????????????????????????????????Щ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????using????????????
???????磺
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using aClass = ConsoleApplication1.MyClass;
using bClass = ConsoleApplication2.MyClass;
namespace ConsoleApplication1
{
????public class MyClass
????{
????????public override string ToString()
????????{
????????????return "You are in ConsoleApplication1.MyClass";
????????}
????}
????class TestUsing
????{
????}
}
namespace ConsoleApplication2
{
????class MyClass
????{
????????public override string ToString()
????????{
????????????return "You are in ConsoleApplication2.MyClass";
????????}
????}
}
namespace TestUsing
{
????using ConsoleApplication1;
????using ConsoleApplication2;
????class ClassTestUsing
????{
????????static void Main()
????????{
????????????aClass my1 = new aClass();
????????????Console.WriteLine(my1);
????????????bClass my2 = new bClass();
????????????Console.WriteLine(my2);
????????????Console.WriteLine("ress any key");
????????????Console.Read();
????????}
????}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11