تصميم المواقع باستخدام بالدلفي بريسم + ASP.net
#9
مثال اله حاسبة بسيط جمع وطرح
datasnap server delphi xe with prism 2.5
كود :
prism client web //------------------------ namespace WebApplication1; interface uses System.Web, System.Web.UI, Borland, ClientProxy1; // ,RemObjects.Oxygene,System,RemObjects;System.Collections,//System.DataSnap Data Provider for .NET type _Default = public partial class(System.Web.UI.Page) protected method Button1_Click(sender: System.Object; e: System.EventArgs); method Button3_Click(sender: System.Object; e: System.EventArgs); method Button2_Click(sender: System.Object; e: System.EventArgs); end; implementation method _Default.Button1_Click(sender: System.Object; e: System.EventArgs); var a, b, s: Double; calc: ClientProxy1.TServerMethods_haClient; SQLConnection := Borland.Data.TAdoDbxDatasnapProviderFactory.Instance.CreateConnection() as Borland.Data.TAdoDbxConnection; begin TextBox_R.Text := 'WELCOME MR HASSAN'; SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=172.17.177.189;port=8080'; // SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=localhost;port=80;serverconnection=TServerMethods_ha.GetConnection'; SQLConnection.Open; // TextBox_R.Text:='conn good '; try // a:=36;b:=4; a := Convert.ToDouble(TextBox_a.Text); b := Convert.ToDouble(TextBox_b.Text); TextBox_R.Text := 'WELCOME MR HASSAN'; calc := ClientProxy1.TServerMethods_haClient.Create(SQLConnection); s := calc.Subtract(a, b); TextBox_R.Text := s.ToString; finally SQLConnection.Close; end; end; method _Default.Button2_Click(sender: System.Object; e: System.EventArgs); var a, b, s: Double; calc: ClientProxy1.TServerMethods_haClient; SQLConnection := Borland.Data.TAdoDbxDatasnapProviderFactory.Instance. CreateConnection() as Borland.Data.TAdoDbxConnection; begin TextBox_R.Text := 'WELCOME MR HASSAN'; // SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=172.17.177.189;port=8080;serverconnection=TServerMethods_ha.GetConnection'; SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=172.17.177.189;port=8080'; // SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=172.16.0.190;port=8080;serverconnection=TServerMethods_ha.GetConnection'; // SQLConnection.ConnectionString := 'communicationprotocol=http;hostname=localhost;port=8080;serverconnection=TServerMethods_ha.GetConnection'; SQLConnection.Open; TextBox_R.Text := 'conn good '; try // a:=36;b:=4; a := Convert.ToDouble(TextBox_a.Text); b := Convert.ToDouble(TextBox_b.Text); calc := ClientProxy1.TServerMethods_haClient.Create(SQLConnection); s := calc.Sum(a, b); TextBox_R.Text := s.ToString; finally SQLConnection.Close; end; end; method _Default.Button3_Click(sender: System.Object; e: System.EventArgs); begin response.Redirect(" WebForm1.aspx ") end; end.
الرد


الردود في هذا الموضوع
تصميم المواقع باستخدام بالدلفي بريسم + ASP.net - بواسطة masrnet2006 - 28-07-2012, 01:11 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم