Tuesday, 15 May 2012

asp.net - verification if record posts to multiple tables -


I hope that I have another simple question for someone else. IM is currently working on a website where I have information about a user post on the server and when posted, they are taken to the verification page which states whether it is successfully stored on the .mbd table or not a table There is no problem doing this for me, but I think that when you want to check the information stored in several tables, then let me run into a problem It's a ding.

Here is the code that is using the work that is posted to a single table

  protected Zero Page_Load (Object Sender, EventArgs e) {txtVerifiedInfo. Text = Session ["txtUserFirstName"]. ToString () + "\ n" + session ["txtUserListName"] .toString () + "\ n" + session ["txtUserName"]. ToString () + "\ n" + session ["txtUserPassword"]. ToString () +   

;

 If the record is successfully saved in the tblUserLogin table and text box txtVerifiedInfo (check the correct message in clsDataLayer.SavePersonnel (Server.MapPath ("App_Data \\ WSC_DB  // check" mdb ") ToString (), session ["txtUserListName"]. Session ["txtUserName"]. ToString (), session ["txtUserPassword"]. ToString (),)) {TxtVerifiedInfo. Text = txtVerifiedInfo.Text + "\ nInformation was successfully saved Lly!"; } Verify other {txt}. Text = txt verified. Lesson "The information \ N was not saved."; }}   

}

Whatever I have tried here

  if (clsDataLayer.Saveneworder (server) .MapPath (" Session ["txtfirstName"], session ["txtlastName"]. ToString (), session ["txtstreetAddress"]. ToString (), session ["txtcity"]. Ostring (), Session ["testzipcode"] .toastring ()) & amp; Amp; If (clsDataLayer.Savenewitem (Server.MapPath ("App_Data \\ WSC_DB.mdb"), session ["jobType"]. ToString () + session ["txtmediaContent"]. ToString ())) {txtVerifiedInfo.Text = txtVerifiedInfo. Text + "\ ncorder successfully submitted!"; } Verify other {txt}. Text = txt verified. Lesson "Do not leave the command, please return to the previous screen and verify that all your data is correct, thanks."; }}   

}

I do not imagine that he is close to doing so, but hopefully Ball is in the park.

Any help with this is great. Thank you for your time

To make it simple, it's almost now: path path = Server.MapPath ("App_Data \\ WSC_DB.mdb"); If (clsDataLayer.Saveorder (path, [order parameter] & amp; amp; clsDataLayer.Saveitem (path, [item parameters]) {txtVerifiedInfo.Text = txtVerifiedInfo.Text "" \ nThe order has been successfully submitted! "And

Is not well structured, there is an unnecessary call for Server.MapPath and in L can be better placed as part of an argument for the manufacturer of your Dataiyar class.

Do not you know about the and amp; amp; ; Amp; & amp;; is a shortcut operator - the second part of the argument will not be asked if the first part fails. Do you want this behavior?

I doubt you As part of a transaction, saverder and Saveitem should be successful or unsuccessful. Method in you may be better off a new writing your Ditlayr class does exactly the same.

I'm assuming .mdb indicates in your file name that you are using MS Access? I'm not sure that this is related to the transaction as well as the SQL Server (for example), so you may have to type your own code to delete the order if its item can not be saved (or any unsuccessful behavior needed).

No comments:

Post a Comment