<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script> <script type="text/javascript"> var app = angular.module('MyApp', []) app.controller('MyController', function ($scope, $http, $window) { $scope.GetName = function () { var post = $http({ method: "POST", url: "Home.aspx/GetCustomerName", dataType: 'json', data: '{id:' + $scope.Id + '}', headers: { "Content-Type": "application/json" } }); post.success(function (data, status) { $scope.textbox1= data.d; }); post.error(function (data, status) { $window.alert(data.Message); }); } }); </script>
Public Shared Function GetCustomerName(ByVal id As Integer) As String Dim name As String = "" Dim strConnString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString Using con As SqlConnection = New SqlConnection(strConnString) Using cmd As SqlCommand = New SqlCommand() cmd.Connection = con con.Open() cmd.CommandText = "SELECT round(sum(TotDep)/10000000,2) as Dep FROM ADPL" 'cmd.Parameters.AddWithValue("@Id", id) name = cmd.ExecuteScalar().ToString() con.Close() End Using End Using Return name End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)