Click here to Skip to main content
15,894,180 members
Home / Discussions / Database
   

Database

 
GeneralRe: SSIS Development Workflow Pin
cjb11013-Apr-12 0:21
cjb11013-Apr-12 0:21 
QuestionCan Not Resolve The collation Conflict Pin
yousefshokati1-Apr-12 19:02
yousefshokati1-Apr-12 19:02 
AnswerRe: Can Not Resolve The collation Conflict Pin
Bernhard Hiller1-Apr-12 21:26
Bernhard Hiller1-Apr-12 21:26 
QuestionHow do you lock records in Access 2007 Pin
Richard.Berry1001-Apr-12 9:14
Richard.Berry1001-Apr-12 9:14 
AnswerRe: How do you lock records in Access 2007 Pin
Eddy Vluggen1-Apr-12 22:43
professionalEddy Vluggen1-Apr-12 22:43 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1004-Apr-12 18:02
Richard.Berry1004-Apr-12 18:02 
AnswerRe: How do you lock records in Access 2007 Pin
JOAT-MON4-Apr-12 23:18
JOAT-MON4-Apr-12 23:18 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1005-Apr-12 21:30
Richard.Berry1005-Apr-12 21:30 
Thanks JOAT-MON

That did help! (I think...)

Provider=Microsoft.ACE.OLEDB.12.0;Data source= C:\myDb.accdb; Jet OLEDB:Database Locking Mode=1
'Locking mode: 0 = Page Level, 1 = Record Level


Do you have any idea how I can test this on my pc at home to see if the record is locked?

My code to update the stock quantity is as follows, so I thought of running one instance of the app from Visual Studio and setting a breakpoint somewhere in the code, and then running a second instance of the app on its own from the exe and trying to update the same record, but not sure where I can set the breakpoint.

Friend Function AddStkReceived(ByVal TransactType As String, ByVal StockCode As String, ByVal WH As String, ByVal Qty As Double, ByVal Comment As String) As Boolean
        Dim sucess As Boolean = False
        If IsNothing(Comment) Then Comment = ""
        Dim params() As String = {Qty, StockCode, WH}
        Dim strUpdate As String = "UPDATE stock_qty SET  Qty = Qty + ? WHERE StockCode = ? AND WH = ?"

        If Not DA.UpdateRecord2(strUpdate, params) Then
            sucess = False
        Else
            sucess = True
        End If

        If sucess Then
            If Not WriteStkHist(StockCode, Qty, TransactType, WH, Comment) Then
                sucess = False
            Else
                sucess = True
            End If
        End If

        Return sucess
    End Function


Public Function UpdateRecord2(ByVal strUpdate As String, params() As String) As Boolean
        Dim RecordsUpdated As Integer = 0
        Dim result As Boolean = False

        Using cn As New OleDb.OleDbConnection(cnStr)
            Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter
            Dim cmd As OleDb.OleDbCommand
            cmd = New OleDb.OleDbCommand(strUpdate, cn)
            cmd.CommandTimeout = 30
            For i As Integer = 0 To params.Length - 1
                If params(i) = Nothing Then params(i) = ""
                cmd.Parameters.AddWithValue("?", params(i))
            Next
            da.InsertCommand = cmd
            Try
                cn.Open()
                RecordsUpdated = da.InsertCommand.ExecuteNonQuery()
                cn.Close()
                If RecordsUpdated = 1 Then
                    result = True
                Else
                    result = False
                End If
            Catch ex As Exception
                 result = False
            Finally
                cn.Close()
            End Try
        End Using

        Return result


    End Function


modified 6-Apr-12 4:22am.

GeneralRe: How do you lock records in Access 2007 Pin
JOAT-MON6-Apr-12 8:12
JOAT-MON6-Apr-12 8:12 
AnswerRe: How do you lock records in Access 2007 Pin
Eddy Vluggen5-Apr-12 1:23
professionalEddy Vluggen5-Apr-12 1:23 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1005-Apr-12 22:21
Richard.Berry1005-Apr-12 22:21 
GeneralRe: How do you lock records in Access 2007 Pin
Eddy Vluggen6-Apr-12 1:48
professionalEddy Vluggen6-Apr-12 1:48 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1006-Apr-12 1:56
Richard.Berry1006-Apr-12 1:56 
GeneralRe: How do you lock records in Access 2007 Pin
Eddy Vluggen6-Apr-12 2:07
professionalEddy Vluggen6-Apr-12 2:07 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1006-Apr-12 2:16
Richard.Berry1006-Apr-12 2:16 
GeneralRe: How do you lock records in Access 2007 Pin
Eddy Vluggen6-Apr-12 2:31
professionalEddy Vluggen6-Apr-12 2:31 
GeneralRe: How do you lock records in Access 2007 Pin
Richard.Berry1006-Apr-12 2:41
Richard.Berry1006-Apr-12 2:41 
GeneralRe: How do you lock records in Access 2007 Pin
Eddy Vluggen6-Apr-12 5:50
professionalEddy Vluggen6-Apr-12 5:50 
QuestionFind Date between two Dates Pin
Robymon30-Mar-12 0:09
Robymon30-Mar-12 0:09 
AnswerRe: Find Date between two Dates Pin
JamesAbbott30-Mar-12 0:40
JamesAbbott30-Mar-12 0:40 
GeneralRe: Find Date between two Dates Pin
Robymon30-Mar-12 1:26
Robymon30-Mar-12 1:26 
QuestionSQL Server Command Line Compile Pin
Kevin Marois29-Mar-12 11:28
professionalKevin Marois29-Mar-12 11:28 
AnswerRe: SQL Server Command Line Compile Pin
PIEBALDconsult29-Mar-12 12:12
mvePIEBALDconsult29-Mar-12 12:12 
GeneralRe: SQL Server Command Line Compile Pin
Kevin Marois29-Mar-12 12:17
professionalKevin Marois29-Mar-12 12:17 
GeneralRe: SQL Server Command Line Compile Pin
PIEBALDconsult29-Mar-12 14:53
mvePIEBALDconsult29-Mar-12 14:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.