• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Sql
  • php
  • C program
  • Seo

Codelack.com

  • Home
  • C++
  • networking
  • Sql server
    • what is rdbms | one to one | one to many | many to many relation-codlack
    • sql server create table
    • code rules in sql server
  • ASP.NET
    • control state in asp.net
    • cookie in asp.net
    • datalist control in asp .net
    • Using ASP.NET To Send Email
    • application state in asp.net
    • file upload control in asp.net
  • contact us
  • Data structure
    • what is Data structure
    • doubly linked list program in c
    • Array in data structure
    • circular queue in data structure
    • Linear data structure
    • Delete node at any position in singly linked list
    • dequeue in data structure
    • implementation of stack using a Linked list in data structure
    • implementation of stack using array in data structure
    • linked list algorithm
    • linked list in data structure
  • C
    • continue and break in c
    • history of c programming language
    • array program in c
    • c programming practice questions
    • enumeration in c
    • C programs with solutions
    • Characteristic of c
    • print 1 to 100 without using loop in c program
    • two single dimension 2D array in c
  • php
    • php
    • Variables in PHP
    • Scalar data types in php
    • Output function in php
    • how to use php string functions | example of string function
    • point to point configuration
    • error in php
    • Array in  php

C#

Print Star Pattern in c

June 17, 2019 by admin Leave a Comment

Print * pattern in c 

Filed Under: C program Tagged With: C#

crud operations in asp.net gridview using jquery

June 17, 2019 by admin Leave a Comment

crud operations in asp.net gridview using jquery


<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”CS.aspx.cs” Inherits=”_Default” %> 

Name:Country: 
<script type="text/javascript">
    $(function () {
        $.ajax({
            type: "POST",
            url: "CS.aspx/GetCustomers",
            data: '{}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess
        });
    });

    function OnSuccess(response) {
        var xmlDoc = $.parseXML(response.d);
        var xml = $(xmlDoc);
        var customers = xml.find("Table");
        var row = $("[id*=gvCustomers] tr:last-child").clone(true);
        $("[id*=gvCustomers] tr").not($("[id*=gvCustomers] tr:first-child")).remove();
        $.each(customers, function () {
            var customer = $(this);
            AppendRow(row, $(this).find("CustomerId").text(), $(this).find("Name").text(), $(this).find("Country").text())
            row = $("[id*=gvCustomers] tr:last-child").clone(true);
        });
    }

    function AppendRow(row, customerId, name, country) {
        //Bind CustomerId.
        $(".CustomerId", row).find("span").html(customerId);

        //Bind Name.
        $(".Name", row).find("span").html(name);
        $(".Name", row).find("input").val(name);

        //Bind Country.
        $(".Country", row).find("span").html(country);
        $(".Country", row).find("input").val(country);
        $("[id*=gvCustomers]").append(row);
    }

    //Add event handler.
    $("body").on("click", "[id*=btnAdd]", function () {
        var txtName = $("[id*=txtName]");
        var txtCountry = $("[id*=txtCountry]");
        $.ajax({
            type: "POST",
            url: "CS.aspx/InsertCustomer",
            data: '{name: "' + txtName.val() + '", country: "' + txtCountry.val() + '" }',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                var row = $("[id*=gvCustomers] tr:last-child").clone(true);
                AppendRow(row, response.d, txtName.val(), txtCountry.val());
                txtName.val("");
                txtCountry.val("");
            }
        });
        return false;
    });

    //Edit event handler.
    $("body").on("click", "[id*=gvCustomers] .Edit", function () {
        var row = $(this).closest("tr");
        $("td", row).each(function () {
            if ($(this).find("input").length > 0) {
                $(this).find("input").show();
                $(this).find("span").hide();
            }
        });
        row.find(".Update").show();
        row.find(".Cancel").show();
        row.find(".Delete").hide();
        $(this).hide();
        return false;
    });

    //Update event handler.
    $("body").on("click", "[id*=gvCustomers] .Update", function () {
        var row = $(this).closest("tr");
        $("td", row).each(function () {
            if ($(this).find("input").length > 0) {
                var span = $(this).find("span");
                var input = $(this).find("input");
                span.html(input.val());
                span.show();
                input.hide();
            }
        });
        row.find(".Edit").show();
        row.find(".Delete").show();
        row.find(".Cancel").hide();
        $(this).hide();

        var customerId = row.find(".CustomerId").find("span").html();
        var name = row.find(".Name").find("span").html();
        var country = row.find(".Country").find("span").html();
        $.ajax({
            type: "POST",
            url: "CS.aspx/UpdateCustomer",
            data: '{customerId: ' + customerId + ', name: "' + name + '", country: "' + country + '" }',
            contentType: "application/json; charset=utf-8",
            dataType: "json"
        });

        return false;
    });

    //Cancel event handler.
    $("body").on("click", "[id*=gvCustomers] .Cancel", function () {
        var row = $(this).closest("tr");
        $("td", row).each(function () {
            if ($(this).find("input").length > 0) {
                var span = $(this).find("span");
                var input = $(this).find("input");
                input.val(span.html());
                span.show();
                input.hide();
            }
        });
        row.find(".Edit").show();
        row.find(".Delete").show();
        row.find(".Update").hide();
        $(this).hide();
        return false;
    });

    //Delete event handler.
    $("body").on("click", "[id*=gvCustomers] .Delete", function () {
        if (confirm("Do you want to delete this row?")) {
            var row = $(this).closest("tr");
            var customerId = row.find("span").html();
            $.ajax({
                type: "POST",
                url: "CS.aspx/DeleteCustomer",
                data: '{customerId: ' + customerId + '}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    row.remove();
                }
            });
        }

        return false;
    });
</script>
</form>
  • What is ASP.NET DataList Control

Filed Under: asp.net Tagged With: asp.net, C#

FormView Control in aap.net with example

December 25, 2018 by admin Leave a Comment

ForThe FormView control is used to displays the values of a single record from a data source using user-defined templates.
The FormView control allows you to edit, delete, and insert records.

The FormView control is used to display a single record from a data source in a table. When using the FormView control, you specify templates to display and edit bound values.

The templates contain formatting, controls, and binding expressions to create the form. The FormView control is often used in combination with a GridView control for master/detail scenarios where the selected record of the master control determines the record to display in the FormView control.

FormView is a new data-bound control that is nothing but a templated version of DetailsView control. The major difference between DetailsView and FormView is, here user need to define the rendering template for each item.

The FormView control gives you the ability to work with a single record from a data source, similar to the DetailsView control. The difference between the FormView and the DetailsView controls is that the DetailsView control uses a tabular layout where each field of the record is displayed as a row of its own.

The FormView control provides the user interface (UI) for navigating between records. To enable paging behavior, set the AllowPaging property to true and specify a PagerTemplate value.

The FormView control can automatically page over the data in its associated data source one record at a time, provided that the data is represented by an object implementing the ICollection interface, or that the underlying data source supports paging.

 

The FormView control is used to display a single record from a data source. It is similar to the DetailsView control, except it displays user-defined templates instead of row fields.
Creating your own templates gives you greater flexibility in controlling how the data is displayed. The FormView control supports the following features: Binding to data source controls, such as SqlDataSource and ObjectDataSource. Built-in inserting capabilities. Built-in updating and deleting capabilities. Built-in paging capabilities. Programmatic access to the FormView object model to dynamically set properties, handle events, and so on. Customizable appearance through user-defined templates, themes, and styles.

Filed Under: asp.net, Uncategorized Tagged With: asp.net, C#

jagged array | Jagged array in C# with example

November 5, 2018 by admin Leave a Comment

Jagged array is an array of arrays.

If we want to hold different column values in different rows then we should prefer jagged array.

jagged array also   store  the data in the form of row  and column like, two dimensional array, but two dimensional array. all the row will be  having equal number of column where as jagged  array the column size different form row  to row.

Jagged array also known as array  of array   because  here  different single dimensional  array  between different signs combined together to form a new array.

Syntax

<type>[ ] [ ]<name>= new <type>[ rows] [];

Int [ ] [ ] arr = new int [3][ ];

Int[ ] [ ] arr = { list of values ];

NOTE

While  declaring  a jagged  array in  that initial declaration we can only specified no of row the new no of row to the array and then are need to specified the column to each row individual.

Initialization of jagged array

arr[0] = new int [ 4 ]

arr[0] = new int [ 6 ]

Benifit of jagged array

  • Minimise of space .
  • Minimize of code .

Filed Under: asp.net, c# Tagged With: C#, jagged array

ADO tutorial

September 20, 2018 by admin Leave a Comment

ADO Introduction

                      Pretty much every application deals with data in some manner, whether that data comes from memory, databases, XML files, text files, or something else. The location where we store the data can be called as a Data Source or Data Store where a Data Source can be a file, database, or indexing server etc.

                       Programming Languages cannot communicate with Data Sources directly because each Data Source adopts a different Protocol (set of rules) for communication, so to overcome this problem long back Microsoft has introduced intermediate technologies like JET, Odbc and Oledb which works like bridge between the Applications and Data Sources to communicate with each other.

The Microsoft Jet Database Engine is a database engine on which several Microsoft products have been built. A database engine is the underlying component of a database, a collection of information stored on a computer in a systematic way. The first version of Jet was developed in 1992, consisting of three modules which could be used to manipulate a database. JET stands for Joint Engine Technology, sometimes being referred to as Microsoft JET Engine or simply Jet. Microsoft Access and Excel uses Jet as their underlying database engine. Over the years, Jet has become almost synonymous with Microsoft Access, to the extent where many people refer to a Jet database as an “Access database”. MS developed Jet database system, a C-based interface allowing applications to access that data, and a selection of driver DLLs that allowed the same C interface to redirect input and output to databases. However, Jet did not use SQL; the interface was in C and consisted of data structures and function calls.

ODBC (Open Database Connectivity)

ODBC (Open Database Connectivity) is a standard C programming language middle ware API for accessing database management systems (DBMS). ODBC accomplishes DBMS independence by using an ODBC driver as a translation layer between the application and the DBMS. The application uses ODBC functions through an ODBC driver manager with which it is linked, and the driver passes the query to the DBMS. An ODBC driver will be providing a standard set of functions for the application to use, and implementing DBMS-specific functionality. An application that can use ODBC is referred to as “ODBC-compliant”. Any ODBC-compliant application can access any DBMS for which a driver is installed. Drivers exist for all major DBMSs as well as for many other data sources like Microsoft Excel, and even for text or CSV files. ODBC was originally developed by Microsoft during the early 1990s.

OLE DB (Object Linking and Embedding, Database)

OLE DB (Object Linking and Embedding, Database, sometimes written as OLEDB or OLE-DB), an API designed by Microsoft, allows accessing data from a variety of sources in a uniform manner. The API provides a set of interfaces implemented using the Component Object Model (COM). Microsoft originally intended OLE DB as a higher-level replacement for, and successor to, ODBC, extending its feature set to support a wider variety of non-relational databases, such as object databases and spreadsheets that do not necessarily implement SQL. OLE DB is conceptually divided into consumers and providers. The consumers are the applications that need access to the data, and the providers are the software components that implement the interface and thereby provide the data to the consumer. An OLE DB provider is a software component enabling an OLE DB consumer to interact with a data source. OLE DB providers are alike to ODBC drivers or JDBC drivers for Java. OLE DB providers can be created to access such simple data stores as a text file and spreadsheet, through to such complex databases as Oracle, Microsoft SQL Server, and many others. It can also provide access to hierarchical data stores.

Filed Under: C#, Uncategorized Tagged With: C#

.net framework tutorial

March 25, 2018 by admin Leave a Comment

.NET FRAMEWORK  is the software that is required for execution of the dot net applications on any machine. This software asks the functionalities of an operating system and makes the code do execute on its control providing the benefits. Like:

  1. Platform independency
  2. Security
  3. Automatic memory management


The code which is runs on the under the control of the framework is referred as managed code and the code which runs on the operating system (machine code) is referred as un-managed code.

click here – .net framework latest version download

DEVELOPMENT OF .NET FRAMEWORK:

The development of the dot net framework has been started in the late 90s. Originally under the name NGSW (next generation windows services).

The framework has been developed following a set up specification referred as CLI specification:

CLI specifications are open specifications that are standardizes an ISO and ECMA (European Computer Manufacturer Association).giving a chance to third party to develop the third party.

CLI Specification takes 4 major things:  

CLS (Common Language Specification)

CTS (Common Type System)

BCL (Base Class Library)

VES (Virtual execution System)

[Read more…] about .net framework tutorial

Filed Under: asp.net Tagged With: asp.net, C#

c programming practice questions

December 15, 2017 by admin Leave a Comment

c programming practice questions

What is the output of the following code? 

1.

#include<stdio.h>

main()

{

int i;

for(i=0;i<5;i++)

{

static int a=0;

int b=0;

a++;

b++;

printf(“\na=%d”,a);

printf(“,b=%d”,b);

}

return 0;

}

Ans:

a=1

b=1

a=2

b=1

a=3

b=1

a=4

b=1

a=5

b=1

2.

#include<stdio.h>

main()

{

static int s;

++s;

printf(“\n%d”,s);

if(s<=3)

main();

printf(“\n%d”,s);

return 0;

}

Ans: 1 2 3 4 4 4 4 4

3.

#include<stdio.h>

extern int a;

main()

{

printf(“\na=%d”,a);

return 0;

}

Ans: Linking Error undefined symbol _a

4.

#include<stdio.h>

int a;

main()

{

printf(“\n a = %d”,a);

return 0;

}

Ans: a=0

5.

#include<stdio.h>

extern int a;

main()

{

printf(“\n a = %d”,a);

return 0;

}int a;

Ans: a=0

6.

#include<stdio.h>

extern int a;

main()

{

printf(“\n a = %d”,a);

return 0;

}

int a=5;

Ans: a=5

7.

#include<stdio.h>

extern int a=5;

main()

{

void fun();

printf(“\n a = %d”,a);

fun();

return 0;

}

int a;

void fun()

{

printf(“\n in fun a = %d”,a);

}

Ans: a=5,a=5

8.

#include<stdio.h>

extern int a;

main()

{

void fun();

printf(“\n a = %d”,a);

fun();

return 0;

}

int a=7;

void fun()

{

printf(“\n in fun a = %d”,a);

}

Ans: a=7,a=7

9.

#include<stdio.h>

extern int a=5;

main()

{

void fun();

printf(“\n a = %d”,a);

fun();

return 0;

}

int a;

void fun()

{

printf(“\n in fun a = %d”,a);

}

Ans: a=5,a=5

10.

#include<stdio.h>

void fun(int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;

}

Ans: 23

11.

#include<stdio.h>

main()

{

auto a;

register r;

static s;

extern e;

printf(“\n%d”,sizeof a);

printf(“\n%d”,sizeof r);

printf(“\n%d”,sizeof s);

printf(“\n%d”,sizeof e);

return 0;

}

Ans: 2 2 2 2

Identify the compiler error in the following code?

#include<stdio.h>

void fun(auto int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;   }

Ans: Error

Identify the compiler error in the following code?

#include<stdio.h>

void fun(static int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;

}

Ans: Error

Identify the compiler error in the following code?

#include<stdio.h>

void fun( extern int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;

}

Ans: Error

Identify the compiler error in the following code?

#include<stdio.h>

void fun(register int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;

}

Ans: 23

Identify the compiler error in the following code?

#include<stdio.h>

void fun(typedef int _)

{

printf(“%d”,_);

}

main()

{

fun(23);

return 0;

}

Ans: Error

Identify the error in the following code?
static extern

int a=5;

static int b = 6;

main()

{

printf(“\n%d”,a); printf(“\n%d”,b);

return 0;

}

Ans: 5 6
Identify the error in the following code?

#include<stdio.h>

main()

{

extern int a=5;

printf(“\n %d”,a);

return 0;

}

Ans: 5

Is it possible to declare static function in c language?

Ans: yes it become file scope function

Can we return more than one value by using return statement?

Ans: No

How to return more than one value from a function?

Ans: call by address

Can we use more than one return statement in one function?

Ans: yes

Give an example for function returning void but contains return statement?

Ans:

void abc()

{

printf(“Hello abc”);

return;

}

void main()

{

abc();

}

What is the differences between K&R C style and ANSI C style?

Ans:

K&R-C

int sum(a,b) int a; int b;

{

return (a+b);

}

ANSII-C

int sum(int a,int b)

{

return (a+b);

}

Write a small ‘c’ function to receive any number of arguments?

[Read more…] about c programming practice questions

Filed Under: C program, Uncategorized Tagged With: C#

Primary Sidebar

sql

  • introduction of sql
  • database management system
  • hierarchical database management system
  • what is rdbms | one to one | one to many | many to many relation-codlack
  • codd rules in sql server
  • Character Data Type
  • constraint unique
  • sql server create table

data structure

  • Data structure
  • Linear data structure
  • Array in data structure
  • What is a algorithm
  • stacks in data structure
  • queue data structure
  • dequeue in data structure
  • Priority queue
  • circular queue in data structure
  • linked list algorithm
  • Delete node in singly linked list
  • tree in data structure
  • implementation of stack using array in data structure
  • implementation of stack using a Linked list in data structure
  • Doubly Linked List Implementation

C programming

  • history of c programming language
  • C programs with solutions
  • Characteristic
  • constraint unique
  • continue and break
  • doubly linked list program in c
  • dynamic memory allocation
  • enumeration
  • print 1 to 100 without using loop
  • Variable declaration

c++

  • Introduction to C++ | similarities of  C++ structure and  class
  • default argument in c++
  • access specifiers in c++
  • Function In C++
  • friend function in c++
  • constructor in c++
  • destructor in c++ | How to call destructor C++
  • exception handling in c++

Categories

array multiplication (1) asp.net (10) B.ed (1) C# (1) c# (1) C++ (2) C program (3) FormView control (1) php (2) Seo (5) Sql (1) Uncategorized (12)
disclaimer

Copyright © 2022 · codelack.com