我爱Aspx >> Asp.Net >> SqlConnection.Open()请问在一个Sub里使用SqlConnection和SqlCommand,当跳出Sub时,需不需要把SqlConnection和SqlCommand设为Nothing,并SqlConnection.Close() ???
google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";
因为如果预到异常时,Sub可能会中止,这样的话SqlConnection和SqlCommand会不会还存活着?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim SqlConnection1 As New System.Data.SqlClient.SqlConnection
Dim SqlCommand1 As New System.Data.SqlClient.SqlCommand
SqlConnection1.ConnectionString = strModConnectionString
SqlCommand1.Connection = SqlConnection1
SqlConnection1.Open()
SqlCommand1.CommandText = "Select count(*) from Table"
Msgbox "SqlCommand1.ExecuteScalar()"
"需不需要加入这几行代码?
SqlCommand1=Nothing
SqlConnection1.Close()
SqlConnection1=Nothing
Ҷƪл˵?
如何判断SqlDataReader1.GetStri..[07-06]
关于 Sql 多条件查询传参数的问题[07-06]
VB2005,如何搜索局域网上的SQL主..[07-06]
如果让sql语句判断以今天日期为准..[07-06]
关于MYSQL查总记录条数的问题[07-06]
mysql什么情况下才用索引?[07-06]
求个DB2中的SQL语句[07-06]
mysql_error()函数如果执行的话..[07-06]
高分求救MYSQL简单问题[07-06]
求一个mysql rand()中随机的解决..[07-06]
用C#编写读取和添加xml数据[07-06]
有一年asp项目经验,几个月业余时..[07-06]
紧急求助:如何实现windows2003系..[07-06]
C# 传结构体数组到C++dll中[07-06]
On Error GoTo ErrorHandle 和 T..[07-06]
DXperienceEval-6.2.4-2005 如何..[07-06]
请问能不能调用Google的语言工具..[07-06]
C#的学习路程[07-06]
C#里能使用MFC扩展的dll中的类吗[07-06]
如何判断SqlDataReader1.GetStri..[07-06]