Database problems in VB.NET 2003

T

thorgal

Hello,

I have following problem and don't know how to solve it.

I have 1 database and multiple connections. Now i want to lock the table
where there is an insert, update or delete statement.

Is there a way to lock a table for Reading/Writing and is is still possible
to have 5 connections on the same database and the same table, just as long
as don't change anything?

Tx

I'm working with SQL SERVER 2005 (free version) and VB.NET 2003
 
T

Thorgal

Kerry Moorman schreef:
thorgal,

Why do you want to lock the table instead of using optimistic concurrency?

Unless you have a really, really unique requirement, optimistic concurrency
is the way to go.

Kerry Moorman

Dear,

Because i don't no what "Optimistic Concurrency" is and what it is and
what it those, can you please explain it to me

Tx
 
T

thorgal

Ok, i have looked at it but i still don't know how to add it in my code, off
course i now what it is but how do I implement it in my code???

Public Shared Function InsertAlgemeen(ByVal oa As clsAlgemeen) As Integer
Dim sSQL As String

sSQL = "spInsertTblAlgemeen"

Dim opar1 As New SqlParameter("@Naam", oa.Naam)

Dim opar2 As New SqlParameter("@AantalCellen", oa.AantalCellen)

Dim opar3 As New SqlParameter("@AantalCentrales", oa.AantalCentrales)

Dim opar4 As New SqlParameter("@PrinterAanwezig", oa.PrinterAanwezig)

Dim opar5 As New SqlParameter("@ResetPLC", oa.ResetPLC)

Dim opar6 As New SqlParameter("@OpstartVertraging", oa.OpstartVertraging)

Dim opar7 As New SqlParameter("@Begindag", oa.Begindag)

Dim opar8 As New SqlParameter("@Einddag", oa.Einddag)

Dim id As Integer

Dim odt As New DataTable

odt = clsDatabase.GetDT(sSQL, opar1, opar2, opar3, opar4, opar5, opar6,
opar7, opar8)

For Each DR As DataRow In odt.Rows

id = IIf(Convert.IsDBNull(DR("ID")), "", DR("ID"))

Next

Return id

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top