Showing posts with label pages. Show all posts
Showing posts with label pages. Show all posts

Monday, March 19, 2012

A temporary database

I have three aspx pages with one form in every page, these three pages allows to register a user. Now when I submit every form on every page the data is sent to the database, but somebody has recommended me to store data in a temporary database file, and when user submit last page (form) store all the data in main database.

I use Sql 2000 Server Personal Edition and VB.NET for aspx pages.
How can I use this temporary database in my aspx page?

Now my first form-page:


<%@.Import Namespace="System.Data" %>
<%@.Import Namespace="System.Data.SqlClient" %
<script language="VB" runat="server">
Dim strConnection As New SqlConnection(ConfigurationSettings.AppSettings("myConn"))

Sub Send_data(sender As Object, e As EventArgs)

Dim CmdInsert As New SqlCommand("new_user1", strConnection)
CmdInsert.CommandType = CommandType.StoredProcedure

Dim InsertForm As New SqlDataAdapter()
InsertForm.InsertCommand = CmdInsert

CmdInsert.Parameters.Add("@.Id", SqlDbType.bigint)
CmdInsert.Parameters("@.Id").Direction = ParameterDirection.Output

CmdInsert.Parameters.Add(New SqlParameter("@.e_mail", SqlDbType.varchar, 50, "e_mail"))
CmdInsert.Parameters("@.e_mail").Value = mail.Text()
……….

strConnection.open()
CmdInsert.ExecuteNonQuery
Dim IdUser As integer = CmdInsert.Parameters("@.Id").Value
strConnection.close()

End Sub

Thanks(1) you can generate an id for each user
(2) insert all the data from each page into some temp database( which you have already created ) using the id
(3) finally call some stored proc tht will move all the info from the temp db to the main one..again using the id...if the user decides to cancel ( at any stage) just empty the temp table.

hth|||Could you recommend me an article, manual, reference,etc.. to start with temporary databases please? I have never worked with them.|||its just another table thts xactly similar in structure to your actual table that you want to put the records in..there are some sys temp tables but i was referring to user created table...sorry if i misled you..

hth|||Before I take the decision of using 'temp tables' I want to know, sure, if it is better passing all the values of the forms with a session variable through the pages until the end, and then do the insert into the main (real) database, or if it is better to do the inserts in every page and use 'temp tables'. Or do the inserts in every page and store the userName and Password in a session variable and do the insert of these 'key' fields in the last page when the registration is complete.

Some experienced ideas please?|||It depends upon the amount of data. Will have have 100 bytes of data over the screens, or 20000 bytes? If 100 bytes, session will be fine, if 20000 then probably not. In addition, rather than using a temp table, you might just want to add a "pending" flag in the real table, and the add data as you go along (with pending set to true) and then on the last page, save last of the data and clear the pending flag.|||I don' t know exactly the amount of data, it is more or less ten fields per page (3 pages). Five with number values and five with text values with max length 50, and some text area field.
Anyway, regardless of the amount of data, Is it better to use a 'pending' flag in the real table? Now I don' t know anything about this system.

Thanks,
Cesar|||I tend to prefer it, as it saves some rewriting of data. Are you already using the Session for other things? If so, it might be reasonable to add this information and then not persist anything in the DB until they are done. With either other plan, you need to have a way to clean up junk (Pending in live or records in the temp).|||Every character is one byte, isn' t it? In afirmative case the amount of data per page will be less than 200 bytes.|||Ok thank you very much|||.NET uses Unicode, so each character in a string is 2 bytes. Either 200 or 400 bytes would be reasonable for the session, unless you have thousands of users, or unless you want to avoid using the session for other reasons.

A temporary database

Hi !

I use Sql 2000 Server as a database and an ASP.NET application with VB.NET language.

Now I am working with three pages with one form in every page that allows to register a user. To accomplish the registration the user needs to fill all the three pages, but now I am sending the data to the database in every page, so if a user leaves the process before reaching the third page it will have an invalid user entry into the database that I don t want. To avoid this I was recommended to store the in a temporary database file. I have been searching information about this but I have not found it.

Somebody can help me finding the necessary documentation to achieve it please?

ThanksOriginally posted by cesark29
Hi !

I use Sql 2000 Server as a database and an ASP.NET application with VB.NET language.

Now I am working with three pages with one form in every page that allows to register a user. To accomplish the registration the user needs to fill all the three pages, but now I am sending the data to the database in every page, so if a user leaves the process before reaching the third page it will have an invalid user entry into the database that I don t want. To avoid this I was recommended to store the in a temporary database file. I have been searching information about this but I have not found it.

Somebody can help me finding the necessary documentation to achieve it please?

Thanks

I have not worked on asp or any other front ends but what i feel is, u should hold all the data in these previous pages in some hidden variables or something and pass it when the user completes the whole registration process.|||I know that passing the data from one page to another is an option, but I think that is better to pass the minimum data as you can between pages. Anyway if you think that is a good option explain me in which cases a temporary database is used.

Thanks !|||Originally posted by cesark29
I know that passing the data from one page to another is an option, but I think that is better to pass the minimum data as you can between pages. Anyway if you think that is a good option explain me in which cases a temporary database is used.

Thanks !
using database for storing these values will make the page slower since it will have to go to the database three times.Instead, it is very common to use sessions for such scenarios.
Regarding temperory databases, they are used internally to hold temperory tables and temperory stored procedures.they are used to store any work tables or temperory tables used while processing
to know more about the temp database check out BOL under System databases and data.|||Good harshal, thank you very much.

Sunday, March 11, 2012

A single group spanning pages...

Is there any way to identify if a group is going to be split between pages?
I basically want to put a
"product XXX continued on next page..." at the bottom of the page if the
group is going to be split. Thanks in advance.
MichaelOn May 18, 10:10 am, Michael C <Micha...@.discussions.microsoft.com>
wrote:
> Is there any way to identify if a group is going to be split between pages?
> I basically want to put a
> "product XXX continued on next page..." at the bottom of the page if the
> group is going to be split. Thanks in advance.
> Michael
As far as I know, there is not; however, you could try using an
expression like follows to group by:
=Ceiling(RowNumber(Nothing)/NumberOfRowsPerPage)
And then set the table/matrix control to start each group on a new
page. Then you could check to determine how many rows are in the
dataset and divide those by NumberOfRowsPerPage to determine
(possibly) the number of pages to put the message on. Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||http://blogs.msdn.com/chrishays/archive/2006/09/27/ContinuedHeader.aspx
"Michael C" wrote:
> Is there any way to identify if a group is going to be split between pages?
> I basically want to put a
> "product XXX continued on next page..." at the bottom of the page if the
> group is going to be split. Thanks in advance.
> Michael
>