Problem two users writing to the same file at same time

Discussion in 'ASP .Net' started by id10t error, Aug 31, 2009.

  1. id10t error

    id10t error Guest

    Hello,

    I am making a scanner application. It is an asp.net program. I am
    having a problem when the users are using two scanners at one and they
    try to write to the TPS file at the same time. Here is my code. Is
    there anything i am doing wrong. If two people scan at the same time
    the scanners will freeze up.

    TPSupdate.ConnectionString =
    ConfigurationManager.AppSettings.Get("DSNEMPMST")
    TPSupdate.ConnectionString =
    ConfigurationManager.AppSettings.Get("EMPMSTconnection")
    'Opens the connection to get data from TPS file
    TPSupdate.Open()
    'Declares an object of OdbcCommand Object to execute the
    select statement
    Dim insertCmd As New Data.Odbc.OdbcCommand()
    'Sets the propertirs of the command object
    insertCmd.Connection = TPSupdate
    insertCmd.CommandTimeout = 1000
    'This will setup the record to be inserted into the table
    insertCmd.CommandText = "Insert into RFPRD
    (Numberscan,storenum,programid,usernumber,datescanned,timescanned)
    Values ('" & numberscan & "','" & storenumber & "','" & programid &
    "'," & userid & "," & todaynumber & "," & currenttime & ")"
    'This is the command that will insert the record into
    RFPRD.tps
    insertCmd.ExecuteNonQuery()
    insertCmd.Dispose()
    TPSupdate.Close()
    TPSupdate.Dispose()
    id10t error, Aug 31, 2009
    #1
    1. Advertising

  2. On Aug 31, 3:39 pm, id10t error <> wrote:
    > Hello,
    >
    > I am making a scanner application. It is an asp.net program. I am
    > having a problem when the users are using two scanners at one and they
    > try to write to the TPS file at the same time. Here is my code. Is
    > there anything i am doing wrong. If two people scan at the same time
    > the scanners will freeze up.
    >
    >             TPSupdate.ConnectionString =
    > ConfigurationManager.AppSettings.Get("DSNEMPMST")
    >             TPSupdate.ConnectionString =
    > ConfigurationManager.AppSettings.Get("EMPMSTconnection")
    >             'Opens the connection to get data from TPS file
    >             TPSupdate.Open()
    >             'Declares an object of OdbcCommand Object to execute the
    > select statement
    >             Dim insertCmd As New Data.Odbc.OdbcCommand()
    >             'Sets the propertirs of the command object
    >             insertCmd.Connection = TPSupdate
    >             insertCmd.CommandTimeout = 1000
    >             'This will setup the record to be inserted into the table
    >             insertCmd.CommandText = "Insert into RFPRD
    > (Numberscan,storenum,programid,usernumber,datescanned,timescanned)
    > Values ('" & numberscan & "','" & storenumber & "','" & programid &
    > "'," & userid & "," & todaynumber & "," & currenttime & ")"
    >             'This is the command that will insert the record into
    > RFPRD.tps
    >             insertCmd.ExecuteNonQuery()
    >             insertCmd.Dispose()
    >             TPSupdate.Close()
    >             TPSupdate.Dispose()


    Post your connection strings here. Did you try to add Try..End Try to
    catch the exception (if any)?
    Alexey Smirnov, Aug 31, 2009
    #2
    1. Advertising

  3. id10t error

    id10t error Guest

    On Aug 31, 1:17 pm, Alexey Smirnov <> wrote:
    > On Aug 31, 3:39 pm, id10t error <> wrote:
    >
    >
    >
    >
    >
    > > Hello,

    >
    > > I am making a scanner application. It is an asp.net program. I am
    > > having a problem when the users are using two scanners at one and they
    > > try to write to the TPS file at the same time. Here is my code. Is
    > > there anything i am doing wrong. If two people scan at the same time
    > > the scanners will freeze up.

    >
    > >             TPSupdate.ConnectionString =
    > > ConfigurationManager.AppSettings.Get("DSNEMPMST")
    > >             TPSupdate.ConnectionString =
    > > ConfigurationManager.AppSettings.Get("EMPMSTconnection")
    > >             'Opens the connection to get data from TPS file
    > >             TPSupdate.Open()
    > >             'Declares an object of OdbcCommand Object to execute the
    > > select statement
    > >             Dim insertCmd As New Data.Odbc.OdbcCommand()
    > >             'Sets the propertirs of the command object
    > >             insertCmd.Connection = TPSupdate
    > >             insertCmd.CommandTimeout = 1000
    > >             'This will setup the record to be inserted into the table
    > >             insertCmd.CommandText = "Insert into RFPRD
    > > (Numberscan,storenum,programid,usernumber,datescanned,timescanned)
    > > Values ('" & numberscan & "','" & storenumber & "','" & programid &
    > > "'," & userid & "," & todaynumber & "," & currenttime & ")"
    > >             'This is the command that will insert the record into
    > > RFPRD.tps
    > >             insertCmd.ExecuteNonQuery()
    > >             insertCmd.Dispose()
    > >             TPSupdate.Close()
    > >             TPSupdate.Dispose()

    >
    > Post your connection strings here. Did you try to add Try..End Try to
    > catch the exception (if any)?- Hide quoted text -
    >
    > - Show quoted text -


    Here are my connection string
    <add key="DSNEMPMST" value="DSN=Encryption" />
    <add key="EmpmstConnection" value="DRIVER=SoftVelocity Topspeed
    driver (*.tps);DBQ=C:\Documents and Settings\Desktop\RF Project\" />.
    Yes I do have a try its just above the code i copied. It did not do
    anything for me. The sanners just freeze up and nothing happens.
    id10t error, Aug 31, 2009
    #3
  4. On Aug 31, 8:17 pm, id10t error <> wrote:
    > On Aug 31, 1:17 pm, Alexey Smirnov <> wrote:
    >
    >
    >
    >
    >
    > > On Aug 31, 3:39 pm, id10t error <> wrote:

    >
    > > > Hello,

    >
    > > > I am making a scanner application. It is an asp.net program. I am
    > > > having a problem when the users are using two scanners at one and they
    > > > try to write to the TPS file at the same time. Here is my code. Is
    > > > there anything i am doing wrong. If two people scan at the same time
    > > > the scanners will freeze up.

    >
    > > >             TPSupdate.ConnectionString =
    > > > ConfigurationManager.AppSettings.Get("DSNEMPMST")
    > > >             TPSupdate.ConnectionString =
    > > > ConfigurationManager.AppSettings.Get("EMPMSTconnection")
    > > >             'Opens the connection to get data from TPS file
    > > >             TPSupdate.Open()
    > > >             'Declares an object of OdbcCommand Object to execute the
    > > > select statement
    > > >             Dim insertCmd As New Data.Odbc.OdbcCommand()
    > > >             'Sets the propertirs of the command object
    > > >             insertCmd.Connection = TPSupdate
    > > >             insertCmd.CommandTimeout = 1000
    > > >             'This will setup the record to be inserted into the table
    > > >             insertCmd.CommandText = "Insert into RFPRD
    > > > (Numberscan,storenum,programid,usernumber,datescanned,timescanned)
    > > > Values ('" & numberscan & "','" & storenumber & "','" & programid &
    > > > "'," & userid & "," & todaynumber & "," & currenttime & ")"
    > > >             'This is the command that will insert the record into
    > > > RFPRD.tps
    > > >             insertCmd.ExecuteNonQuery()
    > > >             insertCmd.Dispose()
    > > >             TPSupdate.Close()
    > > >             TPSupdate.Dispose()

    >
    > > Post your connection strings here. Did you try to add Try..End Try to
    > > catch the exception (if any)?- Hide quoted text -

    >
    > > - Show quoted text -

    >
    > Here are my connection string
    > <add key="DSNEMPMST" value="DSN=Encryption" />
    >   <add key="EmpmstConnection" value="DRIVER=SoftVelocity Topspeed
    > driver (*.tps);DBQ=C:\Documents and Settings\Desktop\RF Project\" />.
    > Yes I do have a try its just above the code i copied. It did not do
    > anything for me. The sanners just freeze up and nothing happens.- Hide quoted text -
    >
    > - Show quoted text -


    I tried to google for concurrent connections in Clarion and found that
    they use "2 separate database profiles (to ensure concurrent
    connection sessions)"
    http://www.sqlexec.com/DBMAN/DBManHelp.pdf (page 48)

    Will it work? I don't know. Try it and if it does not work go to
    www.softvelocity.com
    Alexey Smirnov, Aug 31, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HNguyen
    Replies:
    4
    Views:
    2,398
    HNguyen
    Dec 21, 2004
  2. Shawn
    Replies:
    2
    Views:
    370
    =?Utf-8?B?RWx0b24gVw==?=
    Feb 19, 2006
  3. darrel
    Replies:
    2
    Views:
    470
    darrel
    Apr 5, 2006
  4. evenrik
    Replies:
    3
    Views:
    375
    Vinay Sajip
    Dec 11, 2007
  5. Jens Thoms Toerring

    Writing to same file from two threads

    Jens Thoms Toerring, Feb 26, 2013, in forum: Python
    Replies:
    6
    Views:
    174
    Antoine Pitrou
    Mar 1, 2013
Loading...

Share This Page