Hello Newsgroup,
I have written a very short program to get information from a whole
table out of a database. the problem is that other people couldn't
work on this table during the process. It seems that my program locks
the whole table.
I used the DataReader from the .NET Framework. Can you please take a
look at the code and give me any solution??? Thank very much, Nils
Dim strSQL As String = "SELECT * FROM TESTTABLE"
Dim Conn As System.Data.SqlClient.SqlConnection = New
System.Data.SqlClient.SqlConnection("Data Source=1.1.1.1;
User ID=sa;Password=secret;Persist Security Info=True;
Initial Catalog=TestDB")
Conn.Open()
Dim SqlCmd As SqlCommand = New SqlCommand(strSQL,Conn)
Dim DR As System.Data.SqlClient.SqlDataReader
Try
DR = SqlCmd.ExecuteReader
Do While DR.Read()
<only reading with DR.item("columnname")>
Loop
Catch ex As Exception
errorhandler(ex.ToString)
Finally
If DR.IsClosed = False Then DR.Close()
SqlCmd.Dispose()
End Try