Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

READING UNCOMMITTED SAVE TO DATATABLE

Hi All,

In the middle of inserting data, I want to read that uncommitted table to get another data and store it to datatable.

Private functio Read_Uncommitted_Table(TrsId as string, _
                                                          cmdSQLCommand as sqlcommand) as datatable
   
    dim dtTable as datatable

    return dtTable
End Sub

How could I do it ?

Thank you.

Avatar of s_chilkury
s_chilkury
Flag of United States of America image

This has nothing to do with VB.Net. You sql query which fetches the records from the table has to be written such that it will bring uncommitted data from the DB.

The SP which fetches the records should have the following statement at the start of the batch statements:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
Avatar of emi_sastra
emi_sastra

ASKER

Hi s_chilkury,

Could set it using vb code at the Read_Uncommitted_Table function ?

Thankyou.
Are you using stored procedure or text command? If text command, then try this

sqlcmd.CommandText = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ; Select ..."
Hi CodeCruiser,

I use text command.

Which one is better, Isolation Level or Read With (NoLock) ?
And Why ?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok.

Thank you very much for your help.