• λ我爱Aspx >> Asp.Net >> SqlConnection.Open()
  • SqlConnection.Open()

  • :aspxer  Դ:csdn  :2007-7-6 2:51:50  ؼ:sql
  • 请问在一个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

    Ҷƪл˵?
  • һƪ各位高手帮下菜鸟好么,一个关于树的问题.
    һƪ用C#编写读取和添加xml数据