?
Solved

asp.net vb creating a unique id for insert form

Posted on 2010-11-16
3
Medium Priority
?
511 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 57

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 57

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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