Click here to Skip to main content
15,499,801 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to show database data in multiple text boxes using js
I have tried the following but got no success pl help.

In HTML Page

<script type="text/javascript" src=""></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) {

What I have tried:

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
                cmd.CommandText = "SELECT round(sum(TotDep)/10000000,2) as Dep FROM ADPL"
                'cmd.Parameters.AddWithValue("@Id", id)
                name = cmd.ExecuteScalar().ToString()
            End Using
        End Using

        Return name
    End Function
Richard Deeming 26-Sep-22 9:31am    
Since you haven't actually told us what the error is, nor where you are stuck, nobody can help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900