|
Hi,
What would be the best way of making a transaction from a aspx webpage to the SQL database for example,
where a customer orders a product, hits the order button and then this transaction goes through to the database where it automatically updates the records. Any ideas?
cheers
|
|
|
|
|
tgreeny wrote: What would be the best way of making a transaction from a aspx webpage to the SQL database
As you are asking about the best way, I would like to suggest you to use the different layers for making a transaction.. Let's say you are working on the "Product Order" page. So, you should create the Order class in Entity layer. If the user hits the order button after filling the required data on your page, you should fill those data to the "Order" object. then, Call the web service proxy call to invoke the business logic web service.. then, Call the DAL and pass the data from "Order" object to the stored procedure..
So, the structure of project will be like that ~
YourProject.Entities (Class Library)
- Order (Class)
- Orders (Class)
- [WebProxies]
-- OrderProxy (Webservice proxy generated by using wsdl)
YourProject.Web (Web Project)
- ProductOrder.aspx ( Webpage)
YourProject.BO (Web Service)
- OrderBO
YourProject.DAL (Class Library)
- OrderDAL
SQL Server
- OrderStoredProcedure
This is the way that we used in our live project... it works pretty well.. but I think that it might be a lit bit complicated for beginner..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
We can use normal insert sql statement. In the POSTBACK you have to write the script for inserting database. Read all the objects value you enter and using insert into statement insert all in the database.
|
|
|
|
|
i am creating a webpage i want to update the content in my webpage .
ex: the "news " column should update daily. explain briefly with one example;
|
|
|
|
|
Did you consider having that news content in a DIV and periodically update it using XmlHttp?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
He wants to update it *daily*, you want to use AJAX so people who leave the site open for days at a time see updates ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: update it *daily*
Missed that word. I was actually reading news from NDTV website where it shows a little marquee, which perhaps inspired me.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
The obvious thing to do here is to have a database which contains the daily news, a page which allows you to enter news for today, and a main page that pulls the most recent news story and shows it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I need to get a session variable's value (filename) into the aspx page,so that I can load a session based filename into Media Player Embedded.The Jscript works with a static filename at present.
// FROM THE CODE BEHIND THE ASPX PAGE
this.Session["WavName"] = Server.MapPath(@"..\captchaTmpWavs\")
+ this.Session.SessionID + ".wav";
// FROM THE ASPX PAGE
function StartMeUp()
{
MediaPlayer.Filename = "";
}
|
|
|
|
|
you can register the whole javascript function from code behind using clientscript.registerscriptblock
or you can try this
MediaPlayer.Filename = "<%=Session["WavName"]%>";
-----
|
|
|
|
|
Tried this solution and get 'Unknown Exception' when
I press My Run button.
MediaPlayer.Filename = "<%=Session["WavName"]%>";
|
|
|
|
|
I doubted that because I never tested that.
Do this right after you set the session:
<br />
<br />
string script = string.Format("function StartMeUp(){ MediaPlayer.Filename='{0}'; }</SCRIPT>", Session["WavName"]);<br />
<br />
ClientScript.RegisterClientScriptBlock(this.GetType(),"WavName",script,true);<br />
<br />
-----
|
|
|
|
|
The client is stuck for now with framework 1.0
so I had to use the older Page.RegisterClientScriptBlock.
string script = string.Format("function StartMeUp(){
MediaPlayer.Filename='{0}'; }", Session["WavName"].ToString());
Page.RegisterClientScriptBlock("StartMeUp",script);
Compiles fine, but during Page Load I get the error "Input string was not in a correct format." I can't spot the problem.
|
|
|
|
|
in the view source of the HTML page, see what the ending string the above code has registered. You may have to add language='JScript" in and @ sign before Session["WavName"].ToString().
<div class="ForumSig">-----</div>
|
|
|
|
|
You are putting a physical file name in the session variable. That is useless in a web page, you need the virtual file name.
Do you need to keep the file name in the session for some reason? Otherwise you don't need a session variable to put the value in the page. A plain member variable in the page works just fine.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi guys,
I'd like to gather some ideas on how to implement a menu navigation trail feature.
What I am referring to is the feature present on some websites when you go down into the menus.
ie. this site, if you go to http://www.codeproject.com/sqlrs/ the menu trail shows: All Topics, MFC/C++, C#, ASP.NET, .NET, VB.NET >> SQL Reporting Services
|
|
|
|
|
this looks like a linked list. so you have to go to top level node until you don't get any (the top level/parent is null) and display all of them. all parent nodes will be displayed as a link and current node will be displayed without any link
-----
|
|
|
|
|
I guess this approach would work fine if the menu is created dynamically from a DB, so I can pre-populate the linked list.
Thanks!
|
|
|
|
|
|
Hi,
i'm a beginner in asp.net programming and web for that matter,
and in need of some help.
i use an unknown amout of tables that i need to view, lets assume the connection string and select query are entered by the user.
i need in the page_load or somewhere to create a dataset and set the gridview to it. the grid view is a static control on the web form.
now i am using:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("con str");
SqlDataAdapter ad = new SqlDataAdapter("select str", con);
DataSet ds = new DataSet();
ad.Fill(ds, "test");
con.Close();
this.Controls.Add(data);
theGrid.DataSourceID = data.ID;
theGrid.DataSource = ds;
theGrid.DataBind();
}
this works, but each click/change that causes a postback will call page_loaf again. i tried to define the ds variable as private var of the class, and then put the 3 first lines in an if (!postback) {...} statment.
didn't work, the vars are recreated on each post back.
what is the solution for this?
how can i create a grid that will be saved without re binding it?
(and if i don't add the ds to the form as a control, it just doesn't bind)
help!!!
thanks, koren.
kosh2059
kosh2059
|
|
|
|
|
kosh2059 wrote: didn't work, the vars are recreated on each post back.
Yes, because when a request comes in to the web server a page is created, it is populated, it is rendered to the clien browser, the page on the server is then destroyed. The server does not keep a copy of all the pages currently open by the various browsers that are linked to it. So when a browser makes a new request the server has to go through the whole sequence all over again.
|
|
|
|
|
Hi,
I am having the strangest problem when trying to use a standard Javascript popup. When using the popup on my local machine the addressbar is hidden correctly but when I upload the page to the server, the address bar is shown.
The code I've tried so far consists of variations of the following:
window.open("pagename.html","GamePreview", "scrollbars=yes, resizable=no, location=no, toolbar=no");
thanks
ps: I've noticed the same thing happening with the code project preview window.
"In this new wave of technology, you can't do it all yourself, you have to form alliances."
Carlos Slim Helu
|
|
|
|
|
try this
<br />
window.open("pagename.html","GamePreview", "status=no,directories=no,location=no,menubar=no,toolbars=no,scrollbars=yes,resizable=yes");<br />
you can set the values to yes or no as required
-----
|
|
|
|
|
i want to dispaly the contents of xml in iframes without the tags <titie></title> etc....
|
|
|
|
|
Why not use one of the techniques explained in the answers you were given before ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|