?
Solved

asp.net vb creating a unique id for insert form

Posted on 2010-11-16
3
Medium Priority
?
517 Views
Last Modified: 2012-05-10
Hi,
We have a vb.net application within our office and we have recently been asked by a customer to facilitate the process of sending us data by providing an online portal whereby the information they send will be input directly in to our inhouse app (SQL server).

I have created an ASP.NET/VB application and created an input form. You dont need to log in or anything just navigate to the form, fill it in and then submit.
I have got the form working and once the required fields are completed you can click submit and my code uses an sql insert statement to input the data in to our sql server.

The problem is I also ask the user to upload several pictures. There are 4 tickboxes and when you tick each box there is an ajax file uploader.
The problem at the moment is all the images go in to a temporary folder and if more than one person is filling out the form at once that is a huge problem.

How can I assign a unique id to the page impression so I can in turn create a temp dir with the session id as its name - then once the insert statement has been made I can move the images to a new folder and delete the temporary one.
0
Comment
Question by:amgrobins
  • 2
3 Comments
 
LVL 61

Assisted Solution

by:HainKurt
HainKurt earned 2000 total points
ID: 34146322
create an id field in your table
whenever you insert data use
select SCOPE_IDENTITY()
to get the last id inserted

http://msdn.microsoft.com/en-us/library/ms187342.aspx

then use this number to rename your temp files... or create a folder like this...

better you should use a stored procedure/function to insert the data

create procedure insData(... params here ...) as
begin
  insert into myData (...columns here...) values(...params here...);
  select SCOPE_IDENTITY()
end;

so, use this sp and get return value, create a temp folder, upload here, then use rename, move, delete...
0
 

Author Comment

by:amgrobins
ID: 34146526
the problem is I want to upload the files before the form is submitted (i.e before the sql insert).
0
 
LVL 61

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 34147012
then use session id to create a temp folder
it is a unique id created by your web server
use this, create a temp folde rwith this name and upload here (each user will have different files in seperate folder)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question