473,790 Members | 2,850 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inserting to SQL ASP 3.0

Hi guys,

I have a web application that insert Clients info into the Database, the
Apllication is accesed by several user at the same time, the Client Info is
divide by 3 tables (Client, Product and 1 that combine the Client and
Product and having all info for how the client bought the product)

My question is: HOW can I know for sure that the script is not accesed by 2
diferent users?

WHY:
The script looks like this
INSERT blablabla INTO tblClients

INSERT blablabla INTO tblProduct

INSERT idClient, idProduct, blablabla INTO tblSales

idClient and idProduct is the @@identity from thoose inserts...

the question is How do I know for sure that tblSales have the right idClient
and idProduct and not from other client that other user is inserting in that
percision time?

I use Application.Loc k() and Application.UnL ock() before and after I execute
the script, but is this work?
thank you

--
Bruno Alexandre
(Sintra, PORTUGAL)
Nov 19 '05 #1
4 1143
"Bruno Alexandre" <br********@fil trarte.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
the question is How do I know for sure that tblSales have the right
idClient and idProduct and not from other client that other user is
inserting in that percision time?


Use a stored procedure and surround the INSERT statements with a
transaction.
Nov 19 '05 #2
That's why you dont use the AUTONumber/Identity.
Instead use your own table to store the ID.

Call the Key table to get the next ID
Increment the Key table
Use the new ID.

You can get a new key anytime then.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Bruno Alexandre" wrote:
Hi guys,

I have a web application that insert Clients info into the Database, the
Apllication is accesed by several user at the same time, the Client Info is
divide by 3 tables (Client, Product and 1 that combine the Client and
Product and having all info for how the client bought the product)

My question is: HOW can I know for sure that the script is not accesed by 2
diferent users?

WHY:
The script looks like this
INSERT blablabla INTO tblClients

INSERT blablabla INTO tblProduct

INSERT idClient, idProduct, blablabla INTO tblSales

idClient and idProduct is the @@identity from thoose inserts...

the question is How do I know for sure that tblSales have the right idClient
and idProduct and not from other client that other user is inserting in that
percision time?

I use Application.Loc k() and Application.UnL ock() before and after I execute
the script, but is this work?
thank you

--
Bruno Alexandre
(Sintra, PORTUGAL)

Nov 19 '05 #3
Check out the SCOPE_IDENTITY in the Books Online.

"Bruno Alexandre" <br********@fil trarte.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi guys,

I have a web application that insert Clients info into the Database, the
Apllication is accesed by several user at the same time, the Client Info
is divide by 3 tables (Client, Product and 1 that combine the Client and
Product and having all info for how the client bought the product)

My question is: HOW can I know for sure that the script is not accesed by
2 diferent users?

WHY:
The script looks like this
INSERT blablabla INTO tblClients

INSERT blablabla INTO tblProduct

INSERT idClient, idProduct, blablabla INTO tblSales

idClient and idProduct is the @@identity from thoose inserts...

the question is How do I know for sure that tblSales have the right
idClient and idProduct and not from other client that other user is
inserting in that percision time?

I use Application.Loc k() and Application.UnL ock() before and after I
execute the script, but is this work?
thank you

--
Bruno Alexandre
(Sintra, PORTUGAL)

Nov 19 '05 #4
@@identity is the identity of the last insert from the current sql batch.
this is thread safe, so no locking is required (unless you stick the value
into a static or vb module variable). you should look at scope_identity( ),
because if a trigger inserts into a autonumber table, @@identity will be
that value. scope_identity( ) is the last assignment in the current scope
(will ingore trigger inserts).

-- bruce (sqlwork.com)

"Bruno Alexandre" <br********@fil trarte.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi guys,

I have a web application that insert Clients info into the Database, the
Apllication is accesed by several user at the same time, the Client Info
is divide by 3 tables (Client, Product and 1 that combine the Client and
Product and having all info for how the client bought the product)

My question is: HOW can I know for sure that the script is not accesed by
2 diferent users?

WHY:
The script looks like this
INSERT blablabla INTO tblClients

INSERT blablabla INTO tblProduct

INSERT idClient, idProduct, blablabla INTO tblSales

idClient and idProduct is the @@identity from thoose inserts...

the question is How do I know for sure that tblSales have the right
idClient and idProduct and not from other client that other user is
inserting in that percision time?

I use Application.Loc k() and Application.UnL ock() before and after I
execute the script, but is this work?
thank you

--
Bruno Alexandre
(Sintra, PORTUGAL)

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5876
by: Mat | last post by:
Hi, I have a system that uploads images as BLOBs in a database. I also have a function that I use to resize uploaded images before saving as files. I would like to combine these two by resising the images before inserting them as BLOBs. My problem is that (apart from being new to file stuff) my resize function returns a Resource ID which of course is not the same as the file handler that was passed to it, it's a reference to an image...
3
1541
by: James | last post by:
I am in the process of running my site through WC3 validation. I assume the validator at www.w3c.org cant accept cookies and so PHP is attaching &PHPSESSID=lasklijasj09jsad (or similar) to my URLS. The problem is the leading character is a literal & rather than a &amp; and this is stopping the validator telling me my pages are valid. What do I do here --
14
4074
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program generating the 327 passwords, but have had no luck inserting them. =============================================== Here is the code that generates the passwords: =============================================== <% Option Explicit %>
1
2589
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get these message?
2
1534
by: Krishna | last post by:
Hi, I have developed a for dataentry by using datagird in C# windows application, I am using combocolumns, textbox columns for the same, two readonly textboxcolumns for those readonly columns i will assign the default value through nulltextproperty. I am getting all these fine it is inserting,updating without any problem. But while inserting new rows it is not inserting values related to that readonly textboxes, can some one help me...
12
4917
by: desktop | last post by:
Why does insert only work when specifying an iterator plus the object to be inserted: std::vector<intt; std::vector<int>::iterator it; it = t.begin(); t.insert(it,33); If I use push_back instead I don't need to supply the iterator. But what
0
1767
by: gp | last post by:
I am and have been using PDO for about a year now...and have finally gotten around to solving the "DB NULL value" issues I ran into early on... I am looking for suggestions and techniques to deal with inserting DB NULL values into my MySQL 5.x DB Tables....I am running PHP 5.2.x on BSD 6.x with Apache 2.2.x.... As mentioned I am writing all my web apps using the PDO extension to connect and operate on the database. I realized early...
6
1898
by: Bunty | last post by:
I want to insert values in the database.If i insert values one by one then it works till 4 or 5 fields then after it gives error.In my database there are more than 20 field.Pls help me.
2
3097
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography section: Discography --------------------- DiscID
5
2169
by: rando1000 | last post by:
Okay, here's my situation. I need to loop through a file, inserting records based on a number field (in order) and if the character in a certain field = "##", I need to insert a blank record. So here's my method. I created two tables with the same structure as the table I'm inserting from. One table, Split_Temp, is the one I'll be inserting to. The other table, Split_Insert, contains the "Blank" record, which actually just has the word...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.