ASP.NET and ADO.NET

  • Thread starter Thread starter Marcin Tracz
  • Start date Start date
M

Marcin Tracz

Hello!


I've got small problem with ADO.NET.

I have to use transaction on my page. I init connection with DB and
transaction by:


If Conn.State = ConnectionState.Broken Or Conn.State =
ConnectionState.Closed Then
Conn.Open()
End If
Dim ObjTrans As SqlTransaction
Dim command1 As SqlCommand = Conn.CreateCommand()
ObjTrans = Conn.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted)
command1.Connection = Conn
command1.Transaction = ObjTrans

But if I try run

sql2 = "SELECT * FROM TABLE"
command1.CommandText = sql2
dreader = command1.ExecuteReader()
id_drzewo = dreader.GetString(0)

I cannot get data from table. Why I cannot get data with SELECT if I'm
using transaction in ASP.NET. What can I do to get data?

Thanks for help!!

Marcin
 
Back
Top