Click here to Skip to main content
15,900,816 members
Home / Discussions / Database
   

Database

 
AnswerRe: Store Images In SQL Table Pin
Eddy Vluggen17-Mar-12 3:02
professionalEddy Vluggen17-Mar-12 3:02 
AnswerRe: Store Images In SQL Table Pin
jschell17-Mar-12 7:57
jschell17-Mar-12 7:57 
QuestionNot sure where to ask this question... Pin
JohnnyG16-Mar-12 7:41
JohnnyG16-Mar-12 7:41 
AnswerRe: Not sure where to ask this question... Pin
R. Giskard Reventlov16-Mar-12 11:29
R. Giskard Reventlov16-Mar-12 11:29 
GeneralRe: Not sure where to ask this question... Pin
JohnnyG17-Mar-12 2:33
JohnnyG17-Mar-12 2:33 
AnswerRe: Not sure where to ask this question... Pin
PIEBALDconsult18-Mar-12 9:07
mvePIEBALDconsult18-Mar-12 9:07 
QuestionOracle 11g: using cursors inside procedure. Pin
USAFHokie8016-Mar-12 6:20
USAFHokie8016-Mar-12 6:20 
QuestionWhat happens when two users try to access or update the same record (Access) Pin
Richard.Berry10015-Mar-12 12:12
Richard.Berry10015-Mar-12 12:12 
I have a vb.net stock control app that is installed on about 10 workstations. They read/write data to an Access 2007 DB on a server. For all the database interactions, I use routines like the one below. If the function returns false, the I display the error.
The stock figures are getting all messed up. I have checked that all the transactions work correctly on my pc - no problems at all. The users ASSURE me that they have never seen any Error messages (I have also checked that should a function return false, that the error is displayed.)

My question:

1) What happens if two users try to access the same record at the same time?

2) Would the code below throw an exception if the database trasnaction failed?

VB
Public Function UpdateRecord2(ByVal strUpdate As String, params() As String) As Boolean
        Dim RecordsUpdated As Integer = 0
        Dim cnStr As String = "Provider=" & Provider & "; Data source= " & _Database

        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)
            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()
            Catch ex As Exception
                frmMain.Err.DataMethod = "UpdateRecord"
                frmMain.Err.DataErr = ex.Message
                Return False
            Finally
                cn.Close()
            End Try
        End Using

        If RecordsUpdated = 1 Then
            Return True
        Else
            frmMain.Err.DataMethod = "UpdateRecord"
            frmMain.Err.DataErr = "No Records updated"
            Return False
        End If

    End Function


PS: I am trying to migrate the code to work on SQL Server 2008 Express...
AnswerRe: What happens when two users try to access or update the same record (Access) Pin
Mycroft Holmes15-Mar-12 12:41
professionalMycroft Holmes15-Mar-12 12:41 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Richard.Berry10015-Mar-12 18:41
Richard.Berry10015-Mar-12 18:41 
AnswerRe: What happens when two users try to access or update the same record (Access) Pin
Peter_in_278015-Mar-12 13:33
professionalPeter_in_278015-Mar-12 13:33 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Mycroft Holmes15-Mar-12 14:53
professionalMycroft Holmes15-Mar-12 14:53 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Peter_in_278015-Mar-12 15:15
professionalPeter_in_278015-Mar-12 15:15 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Richard.Berry10015-Mar-12 18:49
Richard.Berry10015-Mar-12 18:49 
AnswerRe: What happens when two users try to access or update the same record (Access) Pin
Bernhard Hiller15-Mar-12 21:57
Bernhard Hiller15-Mar-12 21:57 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Richard.Berry10016-Mar-12 7:15
Richard.Berry10016-Mar-12 7:15 
GeneralRe: What happens when two users try to access or update the same record (Access) Pin
Peter_in_278016-Mar-12 10:53
professionalPeter_in_278016-Mar-12 10:53 
QuestionWhat's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 4:18
Trekstuff14-Mar-12 4:18 
AnswerRe: What's the best way to temporarily persist results of a long running SP? Pin
Blue_Boy14-Mar-12 5:00
Blue_Boy14-Mar-12 5:00 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 5:12
Trekstuff14-Mar-12 5:12 
AnswerRe: What's the best way to temporarily persist results of a long running SP? Pin
Eddy Vluggen14-Mar-12 6:16
professionalEddy Vluggen14-Mar-12 6:16 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 7:12
Trekstuff14-Mar-12 7:12 
AnswerRe: What's the best way to temporarily persist results of a long running SP? Pin
Eddy Vluggen14-Mar-12 7:47
professionalEddy Vluggen14-Mar-12 7:47 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 7:52
Trekstuff14-Mar-12 7:52 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Eddy Vluggen14-Mar-12 8:08
professionalEddy Vluggen14-Mar-12 8:08 

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.