我正在使用 sqldatasource 在 asp.net 中连接 oracle 数据库,这是我的连接字符串
<add name="ConnectionString3" connectionString="Data Source=sml; User ID=sml; Password=sml; Unicode=True; Pooling=False;" providerName="System.Data.OracleClient"/>
我打开连接并在选择某些内容后关闭连接。问题是当我浏览数据库会话时,那里存在两个锁定的会话。直到我关闭 asp.net server.can 任何人都可以指导我在 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 CMS20122013.V_DASH_LABELS@CMS", 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