Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem two users writing to the same file at same time

Reply
Thread Tools

Problem two users writing to the same file at same time

 
 
id10t error
Guest
Posts: n/a
 
      08-31-2009
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("EMPMSTconnec tion")
'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,datescan ned,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()
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-31-2009
On Aug 31, 3:39*pm, id10t error <(E-Mail Removed)> 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("EMPMSTconnec tion")
> * * * * * * '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,datescan ned,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)?
 
Reply With Quote
 
 
 
 
id10t error
Guest
Posts: n/a
 
      08-31-2009
On Aug 31, 1:17*pm, Alexey Smirnov <(E-Mail Removed)> wrote:
> On Aug 31, 3:39*pm, id10t error <(E-Mail Removed)> 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("EMPMSTconnec tion")
> > * * * * * * '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,datescan ned,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.
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-31-2009
On Aug 31, 8:17*pm, id10t error <(E-Mail Removed)> wrote:
> On Aug 31, 1:17*pm, Alexey Smirnov <(E-Mail Removed)> wrote:
>
>
>
>
>
> > On Aug 31, 3:39*pm, id10t error <(E-Mail Removed)> 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("EMPMSTconnec tion")
> > > * * * * * * '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,datescan ned,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 4

Will it work? I don't know. Try it and if it does not work go to
www.softvelocity.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to same file from two threads Jens Thoms Toerring Python 6 03-01-2013 02:54 PM
logging.py: mutiple system users writing to same file gettingpermission errors. evenrik Python 3 12-11-2007 12:35 PM
Two processes writing to the same XML file at the same time? darrel ASP .Net 2 04-05-2006 05:30 PM
Prevent two users from accessing the same file at the same time Shawn ASP .Net 2 02-19-2006 03:11 AM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM



Advertisments