"avinash" <pa***********@ rediffmail.com> wrote in message
news:00******** *************** *******@localho st.talkaboutdat abases.com...
hi
my self avi
currently i am developing one application in vb 6 and back end as
sqlserver 7 which is used on lan.
i have some problem. like in my database i have one table salesvoucher
which has 'voucherno' field. when 2-3 user will work on salesform at a
time [since the softwrae will run on lan] then the same voucherno will
save for all users data which is wrong i need to save different voucherno
for each no. is there any way in sqlserver to apply some condition on
database or to set some its property[tables] so that at a time only one
users data will save depend on firstcome first serve base or is there any
way to make changes in programme.
plz help me regarding this i need it very badly.
since its my first lan based software plz give me some books name
regarding this software for vb6 and sqlserver7
If the voucherno must be unique, then you should put a primary key or unique
constraint on that column, so that it's impossible to have duplicates. If
the voucherno is generated on the client, then you would have to handle the
error raised when a duplicate is inserted (such as error 2627 for primary
key violation), generate a new number, and submit it again.
Alternatively, you could generate the voucherno in the database. If you just
need an integer value, then you can use the IDENTITY property to generate
the number for you - see "IDENTITY (Property)" in Books Online. Every time
you insert a new row, MSSQL will generate a new number for you - this avoids
writing any code to generate new numbers.
Regarding books, you might find some useful information about SQL books
here:
http://vyaskn.tripod.com/sqlbooks.htm
Someone else may be able to suggest a good VB/SQL book, or you might want to
post in a VB group.
Simon