2012-11-15 79 views
0

我使用的SqlDataSource在asp.net oracle数据库连接,这里是我的连接字符串asp.net数据库会话不被清除

<add name="ConnectionString3" connectionString="Data Source=sml; User ID=sml; Password=sml; Unicode=True; Pooling=False;" providerName="System.Data.OracleClient"/> 

我打开连接和做选择的东西后,我做关闭connection.Problem是,当我浏览数据库的会话,那里有两个锁定的会话存在那里。并且他们不清除,直到我关闭了asp.net服务器。任何人都可以指导我在asp.net中使用oracle db连接的正确方式,然后在连接数据库后管理连接以清除连接。我的意思是我查询后可以从数据库注销。

更新

Dim con = New OleDbConnection("Data Source=sml; User ID=sml; Password=sml; provider=OraOLEDB.Oracle; Pooling=false") 
    Try 
     con.Open() 
     Dim cmd As New OleDbCommand("SELECT UPDTIME, YBAL_J, SCROLL_J, PENDING_PMT_J, YBAL_B, SCROLL_B, PENDING_PMT_B, CR_DT, OUT_BAL_J, OUT_BAL_B,SUGAR_J,CANE_CRUSH_J,RECOVERY_J,ETHANOL_J,SHEET_J,SUGAR_B,CANE_CRUSH_B,RECOVERY_B,ETHANOL_B FROM [email protected]", con) 

     Dim da As New OleDbDataAdapter(cmd) 
     Dim ds As New DataSet 
     da.Fill(ds) 

     Label1.Text = ds.Tables(0).Rows(0)(0).ToString 
     Label5.Text = ds.Tables(0).Rows(0)(0).ToString 
     Label2.Text = ds.Tables(0).Rows(0)(1).ToString 
     Label3.Text = "Scroll Issued: " & ds.Tables(0).Rows(0)(2).ToString 
     Label4.Text = "Payment Pending: " & ds.Tables(0).Rows(0)(3).ToString 
     Label6.Text = ds.Tables(0).Rows(0)(4).ToString 
     Label7.Text = "Scroll Issued: " & ds.Tables(0).Rows(0)(5).ToString 
     Label8.Text = "Payment Pending: " & ds.Tables(0).Rows(0)(6).ToString 
     Label14.Text = ds.Tables(0).Rows(0)(7).ToString 
     GridView4.Columns(4).HeaderText = ds.Tables(0).Rows(0)(8).ToString 
     GridView9.Columns(4).HeaderText = ds.Tables(0).Rows(0)(9).ToString 
     GridView2.Columns(0).HeaderText = "Crushing [" & ds.Tables(0).Rows(0)(11).ToString & "]" 
     GridView7.Columns(0).HeaderText = "Crushing [" & ds.Tables(0).Rows(0)(16).ToString & "]" 
     con.Close() 
     con.Dispose() 
    Catch ex As Exception 
     con.Close() 
     con.Dispose() 
    Finally 
     con.Close() 
     con.Dispose() 
    End Try 
+0

你检查的,其连接被锁定在了Oracle的用户。尝试探索。它可以给你一些想法。 –

+0

您应该使用try,catch,finally或者由@Geg Smith建议 –

+0

使用try catch一个会话已经被删除,但是一个已经被锁定的状态存在。什么是会话变为锁定的问题? – user1820339

回答