Saturday 22 December 2012

Difference between Hidden Field and Viewstate in asp.net. | Vb.Net

Difference between Hidden Field and Viewstate in asp.net. | Vb.Net

In asp.net hidden field and Viewstate both manage memory management.
we can store value in hidden field and viewstate also.
now lets check the difference between both

1->Hidden Field is server control and Viewstate is variable .
2->Hidden field won't visible in browser same for Viewstate but if we will use hidden field ,
 we will get more extra encrypted code in view source whereas if we will use Viewstate we will not get that much of extra code.
3-><input type="hidden" id="hdn" runat="server">
To assign value  to hidden field .. use value property of hidden field
 hdn.Value="sometext" // assingning value  to hidden field
lablet.text=hdn.value   // storing value of hidden field into variable

For viewstate
Viewstate("storeval")="sometext" // assigning value into viewstate
string str=Viewstate("storeval")   //storing value of viewstate into variable
in c# syntax is different.

so in these way we can use hidden field and view state.
hidden field go to the server but Viewstate maintain  after postback whithout touching server.

I don't know whether we can store Datatable value in hidden field but its possible in Viewstate.


Sunday 16 December 2012

Alert in asp.net on code behind page with vb.net

Alert in asp.net on code behind page with vb.net

 Protected Sub btnEnter_Click( ) Handles btnSubmit.Click

      Dim str As String
    str = "select field1 , field2 from table_name where field1=" & Trim(txtval.Text) & " and field2='somevalue' and tdate='"

& txtdate.SelectedDate & "'"
            Dim datareader_rad As SqlClient.SqlDataReader
            Dim sqlcommandname As New SqlCommand(str, con)
            con.Open()

           datareader_rad= sqlcommandname.ExecuteReader

            If datareader_rad .Read Then
                Try
     Response.Write("<script language='javascript'>alert('already value is  there in list.');</script>")
                Catch ex As Exception
                Finally

                    con.Close()

                End Try
            Else
                con.Close()
                dr.Close()

                Try
                    cmd = New SqlCommand("stoted_procedure_name", con)
                    cmd.CommandType = CommandType.StoredProcedure
                    cmd.Parameters.AddWithValue("@field1", Trim(txt1.Text))
                    cmd.Parameters.AddWithValue("@tablefield2", Trim(txt2.Text))
                    cmd.Parameters.AddWithValue("@time", Trim(txttime.Text))
                       Catch ex As Exception
                End Try
            End If
        End Sub
What  i did here just took one datareader and stored value ,  means stored field all value into datareader then checked using datareader_rad .read it shows if value already present in datareader then will show alert box that "already value is  entered".

     Response.Write("<script language='javascript'>alert('already value is  entered.');</script>")
by this code we can learn about javascript in  code behind  page in asp.net using vb.net



c program | Sorting of given number | implementation of Insertion sort

c program | Sorting of given number  |  implementation of Insertion sort

Logic and examples to sort given number in list.
In this article we will get idea about to sort number .
user will enter the number in any order like 4,5,3,67,8, etc..
and when we include in program it will get output like 3,4,5,8,67.
before to sort given number all the entered number will save in list .
then after it will sort by ascending order like small to bigger number and will show in ordered .
this program we call as Program for implementation of Insertion sort also.

#include<stdio.h>// header file
#include<conio.h>
#define max 20

void main() // start of main
{
int i,j,n,k,t,temp,a[max];//intializing variable and temp memory
clrscr();
printf("\How many no. you want to insert into list:- ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter %d no:- ",i+1);
scanf("%d",&a[i]);
}
printf("\nUnsorted list is:-\n");// will display unsorted list
for(i=0;i<n;i++)
printf("\n%d",a[i]);
for(i=1;i<n;i++)
{
for(j=0;j<i;j++)
{
if(a[i]<a[j])// cheking first value is less than next one
{
temp=a[j];
a[j]=a[i];
for(k=i;k>j;k--)
a[k]=a[k-1];
a[k+1]=temp;
}
}
}
printf("\n\nSorted list is:-\n");// will print sorted order in a list
for(i=0;i<n;i++)
printf("\n%d",a[i]);
getch();
}


Saturday 15 December 2012

Fibonacci series in c program | Mathematical functions code with execution and comments

Fibonacci series  in c program |  Mathematical functions code with execution and comments

How to print first n terms of Fibonacci series in c language
series of addition of last two number is third number.
0,1,2,3,5.........so on
0+1=1
1+2=3
2+3=5.
we can find out fibbonacci series at given number just we have to enter that number.
in this article we will see how to write series program in c language.

/*Program to print first n terms of Fibonacci series*/
#include<stdio.h> // including header files.
#include<conio.h>
void main() // start of main
{
int a,b,c,n,i; // initializing variables
clrscr();

//Accept no. of terms
printf("Enter no. of terms u want in the series: \n");
scanf("%d",&n);
a=1;  // first we initialized a=1 and b as 0. so we can start to in  the series.
b=0;

//print fibbonacci series
for(i=n;i!=0;i--)  //supose n=25 then  check i not equal 0 and decrement of i
{
c=a+b; //c=0+1=1
a=b;    // now now a=2
b=c;   //now b=1
ptint c=1
next execution
c=a+b; //c=0+1=1
a=b;    // now now a=0
b=c;   //now b=1

print 0,1

next execution
c=a+b; //c=2+2=1
a=b;    // now now a=2
b=c;   //now b=2

print 2  so on..


Like this it will print
0,1,2,3,5,8,13,21


printf("%d ",c);
}

getch();
}

Armstrong number example in c program with coments

Armstrong number example in c program with coments

Armstrong number in c program with source code | comments | execution line by line


In this article i have shown how to Write program for Armstrong number in c  using function with while loop.
Basically we can write simple program for Armstrong number but by using function if we are

writing then its  scope will be different.
first of all get all the idea about what is Armstrong number .
its definition then only one programmer can develop his logic.
Armstrong number is number which is equal to sum its individual number cube.
cube means multiplication of same number thrice or three times.
suppose i want to check number 153 is Armstrong or not, then answer is yes .
because , 153=(1*1*1) + (5*5*5) + (3*3*3) =1+125 + 27 =126 + 27=153.
in this line 1 and 5 and 3 are 153 's individual number .and sum of cube of all three

numbers that number.
so , i think you got the little idea about Armstrong number.
so here we are going to write Armstrong number program in c language.

#include<stdio.h>  // including header files
#include<conio.h>
 void armstrong(int n);   // calling function armstrong(int n)
void main()
{
int n;   //initializing variable n
clrscr();
printf("enter the number");
scanf("%d",&n);   //153
arm(n);    // now n=153
getch();
}
void arm (int n)
{
int r,sum=0,no;
no=n;   //no=153
while(n>0)
{
r=n%10;   //taking mod  (153%10)=15 and r=3 and n=15
sum=(r*r*r)+sum; //3*3*3 + sum=27+0=27 so sum=27
n=n/10;   // now n=15

    // after first execution


r=n%10;   //taking mod  (15%10)=1 and mod =5 and n=10
sum=(r*r*r)+sum; //5*5*5 + sum=125+27=152
n=n/10;   // now n=10

     // after second execution

r=n%10;   //taking mod  (10%10)=0 and mod =1 and n=0
sum=(r*r*r)+sum; //1*1*1 + sum=152+1=153
n=n/10;     // after last execution
}
 
if(no==sum)        // now sum=153 and no=153 both are same hence 153 is armstrong number
printf("given number is armstrrong");
else
printf("not armstrong");

}


Armstrong number program is very simple program just we  should know about c logic and loop

syntax and concept about program.

C program code for swap the number | example code and comments

C program code for swap the number | example code and comments

Swapping means change value of one variable into another variable.

suppose int a=9 int b=7
After swapping b=9 and a=7 .
In this program I have shown how to do swaping of number in c program using function


void swap(int,int); // function name is swap
void main()  // opening of main  method
{
int a=10,b=20;  // initializing variable
clrscr();
swap(a,b);  // calling function
getch();
}
void swap(int x, int y)
{
int temp;  // declaring temp variable
temp=x;  // storing value of x into temp    temp=10
x=y;       // storing value of y into x            x=20
y=temp;  // storing vallue of temp which was x value into y  y=10
printf("\n a=%d\n b=%d",x,y);
}

Typecasting in C | Miscelleneous Features |Definition with example and with comments

 Typecasting in C | Miscelleneous Features |Definition with example and  with comments

What is typecasting?
Converting one datatype into another data type is known as typecasting.
for example conversion of int to float and float to  int , int to char and so on..
Basically there is two types of typecasting ..
1->Implicit typecasting
2->Explicit type casting


1:-Implicit typecasting -type casting done by system.
int a=10.8 float

now here float values is  typecasted to int now a=10 and 0.8 is ignored
float b=25
integer value is typecasted to  float b=15.0
Now let see invalid example of  typecasting.
int a ="25"
char a[]=75;
there is no typecasting when string is involved.



2;>Explicit type casting .
type casting  is done by programmer.
int a=9
int b=2

a/b=9/2=4
(float)a/b=9.0/2=4.5
a/(float)b=9/2.0=4.5 variable a and b are type casted to float . they  become 9.0 and 2.0 .
Their values continued to be 9 & 2 in rest of program.



/*How to write Program to illustrate use of typecasting*/
#include<stdio.h>
#include<conio.h>

//main function
void main()
{
float a;
int x=6,y=4;
clrscr();

//Without typecasting x/y
a=x/y;
printf("\n Value of a without typecasting =%f",a);


////After typecasting x/y to float
a=(float) x/y;
printf("\n Value of a after typecasting =%f",a);
getch();
}

Saturday 8 December 2012

How to develop logic in c programming language with programs

How to develop logic in c programming language with programs

C Language  is First  Programming Language.
I Can say it is base of all Programming Language.
To develop the code in Java ,c# , VB , c++ ,Or any Language we need C.
I am not saying that only C is language where you can apply  your all logic but if you will apply then it
will be good.
If  you want to develop logic in c language then you have to learn Simple Programs ..
i.e .
Even - Odd Number.
Prime - Perfect Number.
Armstrong Number.
series of perfect and prime number.
By playing with loops you can improve logic in good way ..
Like
For loop ,
If - Else,
while loop..
goto statement
switch statement

C language gives you idea about ,How to write program using  Array ,Pointers, Structure.
Main thing is that you should know how to declare the variables and  how to initialize them..
How to create a  function and how to call the function which you have already created.
While writing the program , writing comments is also nice idea.

By Using Turbo C Just Use F7 key to check step by step execution .

Pyramid pattern in c program | to print pyramid | comments with for loop

Pyramid pattern in c program | to print pyramid | comments with for loop

In this program we are going to learn how to print  triangle in pyramid  pattern in c program using two for loop.so ,Basically there are two types of pyramid
1->Floyd triangle
2->Pascal triangle.

structure for pyramid

                                t
                               t  t
                             t t  t  t
                            t  t  t  t  t
void main ()// source code
{

int i,j,n;
clrscr();
printf("Enter number of lines\n");
scanf("%d",&n);
for(i=1;i<=n;i++)//loop for number of lines
{
 for(j=0;j<40-i;j++) //for printing spaces
{
printf(" ");
}
 for(j=i;j<=2*i-1;j++)//for printing trinagle on left half
 {
 printf("%d",j%10);
}
for(j=2*i-2;j>=i;j--)//for printing triangle on right half
{
printf("%d",j%10);
}
printf("\n");
}
getch();
}

another way also is there

Another pattern  with source code
* * * * *
* * * *
* * *
* *
*
*/

#include<stdio.h>
int main()
{
int i,j,n;

printf("Enter no. of lines: ");
scanf( "%d",&n);


//for loop for number of lines
for(i=n;i>=1;i--)
{

//for printing stars
for(j=1;j<=i;j++)
 {
printf("* ");
 }
 printf("\n");
}
return 0;
}

so , basically we need two for loops .first for loop for printing number of lines .
How many lines do you need .
then after print one simple star we need to give space for that we need third for loop.
After that triagle for left half and right half.

goto statement in c program | simple goto example in c

goto statement in c program | simple goto example  in c

In this article we are going to learn how to work with goto statement in c programming language.
Basically goto is jump statement which means we can go one point or functionality to another functionality  in same function or within function. for  that we use goto statement.

#include<stdio.h> // including header files
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter the no");
scanf("%d",&n);
if(n % 2==0)
goto even;  // will goto even
else
goto odd;
even:printf("even"); // will print if number is even
odd:printf("odd");
getch();

Addition of two numbers in c program with source code.

Addition of two numbers in c program with source code.


In this article we are going to learn how to add two number entered by user in c programming language using function.
create function  and initialize that function and call that function by passing parameter you want to add.

#include<stdio.h>
void main()
{
  int a,b;
  clrscr();
  printf("\n Enter 2 Number:"); // user will enter two number one by one
  scanf("%d %d",&a,&b); // number will store in variable a and b.
  printf("\Addition=%d",add(a,b)); //calling  function add
}
  int add(int x,int y)  // in function add passed two parameter x and y.
  {
    return(x+y);  // adding two number
  }
return will  give output.

Thursday 6 December 2012

Palindrome program | logic | examples source code | c++

Palindrome  program | logic | examples source code | c++

After reversing if  you are getting same  number it means you are reversing palindrome number.
to reverse the all digit and get same number is symbol of palindrome number.
Lets take examples
121  after reverse it  we will get 121. so we can say 121 is palindrome number.same is with 999=999.
12=21 not palindrome number .Have you seen mirror same functionality is working here.
But here is digit not your  face.so we are going to learn about palindrome number and execution.
we  can reverse string also like did=reverse(did)=did but i dont know about  words just think about digits .ok i think there is enough explanation now time is to do something real .
Let's concentrate to source code in c program.sorry about c language we are going to learn c++.everything is same in c just little about scanf and printf

How to write c++ palindrom number Program with source code


int pali(int);  // function name pali
void main()
{
int n,a;
clrscr();
cout<<"\n enter the number=";
cin>>n;  // accepting number from user
a=palindrom(n);
if(n==a)  // cheking after reversing number is same or not
cout<<"\n number is palindrom";  // yes it is
else
cout<<"\n number is not palindrom";  //no  it is not
getch();
}
int palindrom(int x) //
{
int r,sum=0;
while(x!=0) // till number will there
{
r=x%10; taking mode so we can get at least one number

sum=sum*10+r;   //addition
x/=10; //division
}
return(sum);//function calling
}

in  c or c++ do execution with your own .execution will give you correct logic and method to understand program logic.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.
  1. when error comes like this after executing  asp.net website.
  2. simple way to get rid of this problem is just remove app_offline.htm.
  3. how to remove app_offline.htm file  the question comes .
  4. whenever this query will comes just go to solution explorer and delete app_offline.htm file.
  5. after deleting that file just again refresh website and press F5 to run the program again.

Queristring in vb.net with example | how to use queristring in asp.net

Queristring in vb.net with example | how to use queristring in asp.net

how to use queristring in vb.net .
if we want to pass the information from one page to another IN  .aspx page
in c# or vb.net we need some object which will give flow of data from
one page to another page.so , that is session and queristring.
in this article we will learn how to use response.redirect  to pass data from one page to another page.
Response.Redirect("Default.aspx?from=" & txtfrom.Text & "  &to=" &
txtto.Text & " &last=" & txtlast.Text)
 queristring do same functionality in c# and vb but using syntax is little bit different.
in c# we use + sign whereas in vb we use & sign.
Response.Redirect("Default2.aspx?from=" & txtfrom.Text & "  &to=" &

txtto.Text & " &last=" & txtlast.Text)

above code shows that passing value from first default.aspx to
default2.aspx. where variable from is storing data of txtfrom text box
and to is storing txtto text box value .this value will go to the
default2.aspx where we can utilize that values.

so lets start page 2 default2.aspx.
 we can store from and to value in other variable for use purpose.
 Dim sr as integer
sr=from
Dim dr as integer
dr=to

and we can use it any where on same page .
but remember about  " " and & & sign . many developers like me find difficulties to solve this problem.

basic problem comes when we need to pass more than one paramater then we think about syntax  like where to use & and  '" and "","".
there are very small , simple and very useful think. so , do it very carefully. Don't play with it just work with it.


Tuesday 4 December 2012

strcmp | How to check password in C with Break Statement and while

strcmp  |  How to check password in C with Break Statement and while

I don't have so much idea about its execution but at last its using strcmp to compare
original password and entered password by using f7 key you can get its idea .

#include<stdio.h> //initializing header files
#include<conio.h>
void main()
{
void pass();  // function name pass
clrscr();
pass();
printf("\n\nNow you can proceed...........\n");
getch();
}
void pass()
{
char ar[30],ch; //
int i=0;
printf("\n\nEnter password\n");
while(1)
{
ch=getch();
if(ch==13)
break;
else
{
ar[i]=ch;
i++;
printf("*");
}
}
ar[i]='\0';
if(strcmp(ar,"yourvalue")==0)
return;
else
{
printf("Invalid password try again\nPress any key to continu\n");
getch();
pass();
}
}

c program for positive (+ve)and negative(-ve) number | comments with source code example

c program for positive (+ve)and negative(-ve) number | comments with source code example

Positive number means number which is not negetive means number greater than 0 or equal to zero.
let's take example.
9 - 8=1
After subtracting 8 from 9 we will get out put =1 that is positive.
but if i will subtract 9 from 8 like 8 - 9= -1.
i will get out put like -1.
go to start -> run  -> calc .
it will open calci and then  you can calculate.or do any kind of calculation.so , in this program i am going to show  How to find out positive and negative number.
with comments in c program with source code.at last output.

#include<stdio.h>    //header files//
#include<conio.h>   //for clrscr//
main()
{                           //main start//
int user_number;       //declaration//
clrscr();                    //clear the screen//
printf("enter any number"); //taken number from user//
scanf("%d",&number);
//condition//

if(user_number>0)  //if user number is Greater than zero//
{
printf("\n the given number  is positive");
}

if(user_number<0) //if user number is Less than zero//
{
printf("\n the given number  is negetive");
}
getch();
}               //Let see the out-put
output is
enter any number 68
number  is positive

enter any number -56
a is negative

Tuesday 20 November 2012

C program code for reverse number using function with while loop

 C program code for reverse number using function with  while loop

how to write code to reverse given number in c program using function with comments
#include<stdio.h>  //including header files
#include<conio.h>
long int reverse(long int); // declaring function with parameter
void main()    // start main
{
 long int n;
 clrscr();
 printf("enter the value \n"); // asking for enter the value
 scanf("%ld",&n); // taking value from user
 printf("result=%ld",reverse(n));  //calling function
 getch();
 }
long int reverse(long int a)  // intialization of function
{
 int r;
 long int s=0;
 while (a != 0)  // checking number will not zero
 {
  r=a%10;    
  s=10*(s+r);
  a=a/10;
  reverse(a);  // reversing number
  }
 return (s/10); //returning reversed number
 }
c programming example  for reverse number using function with  while loop

c program factorial number using function.

c program  factorial number  using function.

Take two for loop .first for loop for one to last .
till we want to factorial and second will calculate factorial of each number.
factorial means multiplication of numbers.
example
factorial of 5 is 5*4*3*2*1=120.
so factorial of 5 is 120.
same for 6 is 6*5*4*3*2*1=720.



#include<stdio.h>
#include<conio.h>
long int fact( int*);
void main()
{
  int n;
  clrscr();
  printf("enter the value \n");
  scanf("%d",&n) ;
  printf("result=%ld",fact(&n)) ;
  getch();
  }

 long int fact(int* a)
 {
 long int f=1,sum=0;  //initialization of sum=0 and variable f =1.
 int i,j;
 for(i=1;i<=*a;i++) //execution of for loop
 {
  for(j=1;j<=i;j++) // second for loop
  {
  f=f*i;
  }
  f=i/f;
  sum=sum+f;
  }
  return sum; // will return the factorial of given number.
  }


programming examples for  factorial number  using function

how to draw concentric circles with help of while loop

how to draw concentric circles with help of while loop

concentric  circles which share same axis ,center and origin.
so sphere and disks are concentric circle we can assume.

#include<graphics.h> //graphic shows header file for design in c language.

main()
{
    int gd=DETECT,gm;
    int n,x=10;
    initgraph(&gd,&gm," ");
    printf("How many concentric circles do you want?");//asking for number of circle want to draw.
    scanf("%d",&n);
    while(n!=0)
    {
    circle(240,150,x);
    setcolor(GREEN);// setting color as green.
    x+=10;
    n--;
    }
    getch(); // end of main
    closegraph();
}
programming examples for concentric circles

Array | single dimensional array in c | c# | java | using for loop

Array | single dimensional array in c | c# | java | using for loop

How to print single array value.
array similar datatype collection.
declaration | initialization


int[] arr = new int[3];
    arr[0] = 1;
    arr[1] = 2;
    arr[2] = 3;
    Response.Write(arr[2]);
ptint second  value in array;

    int[] arr = new int[]{ 1, 2, 3, };
    for (int i = 0; i < arr.Length; i++)
    {
        Response.Write(arr[i]);
        Response.Write("<br>");
    }

   
    string[] arr = new string[4]{"hi","how","are","u"};
    for (int i = 0; i < arr.Length; i++)
    {
        Response.Write(arr[i]);
        Response.Write("<br>");
    }
in place of response.write c programmers can write "printf".
in java "System.out.println". this example shows array with int and string data-type

Multidimensional Array | two dimensional array c | c# | java |2*2 | 3*3 examples code

Multidimensional Array | two dimensional array c | c# | java |2*2 | 3*3 examples code

how to use array to perform or to write or to create structure of matrix.
declaration of array using for loop ,initialization of array using for loop.
how to create 2/2 or 3/3 array in simple programming language

creation of 2/2 array which will appear like matrix.

        int[,] arr = new int[2,2]
       
                                {
                                {1, 2,3 } ,
                                {4, 5 ,6},
                               
                               
                                };
        for (int i = 0; i <2; i++)
        {
            for (int j = 0; j<2; j++)
            {
             
                Response.Write((arr[i,j]));
                             
               
            }
            Response.Write("<br>");

        }
 

creation of 3/3 array
       
        int[,] arr = new int[3,3]
                                {
                                {1, 2,3 } ,
                                {4, 5 ,6},
                                  {889, 9 ,93},
                               
                                };
        for (int i = 0; i <3; i++)
        {
            for (int j = 0; j<3; j++)
            {
             
                Response.Write((arr[i,j]));
                             
               
            }
            Response.Write("<br>");

        }
 


printing of 2/3 array using for loop.
 int[,] arr = new int[2,3]
                                {
                                {1, 2,3 } ,
                                {4, 5 ,6},
                               
                               
                                };
        for (int i = 0; i <2; i++)
        {
            for (int j = 0; j<3; j++)
            {
             
                Response.Write((arr[i,j]));
                             
               
            }
            Response.Write("<br>");

        }
response.write use in asp.net to print array so if you want to print in c language just use printf.
whereas in   java it is system.out.println

Sunday 18 November 2012

N-tier | 3-Three | Architecture in asp.net with c# | sql server | insert | display.

N-tier | 3-Three |  Architecture in asp.net with c# | sql server | insert | display.
3-Three | N-tier | Architecture in asp.net with c# | sql server | insert | display. 1->Application layer 2->Database Layer 3->Business layer 4->Entity Layer 1->Application layer Mark up code:-
code Behind/Application layer

using System;
using System.Data.SqlClient;

using asp.netconnectionwith_class.connection;
namespace asp.netconnectionwith_class
{ 
    public partial class _Default : System.Web.UI.Page
    {
         connection.business objBl = new connection.business();
        connection.entity ObjEl = new connection.entity();
protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void btninsert_Click1(object sender, EventArgs e)
        {
         
           int id = Convert.ToInt32(txtid.Text.Trim());
           string nm =Convert.ToString(txtname.Text.Trim());
             
            int i = 0;
            i = objBl.insertintotable(id,nm);
            if (i > 0)
            {
                Response.Write("value inserted succesfully");
            }
            else
            {
                Response.Write("Error in insertion");
            }


        }

        protected void btndisplay_Click(object sender, EventArgs e)
        {

            int i = 0;
            DataSet dt;
            dt =objBl.display();
            i = dt.Tables[0].Rows.Count;
            if (i > 0)
            {
                grdvw.DataSource = dt;
                grdvw.DataBind();
            }
            else
            {
                Response.Write("Error");
            }
          
        
        }
    }
}


business Layer


using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Web;

using asp.netconnectionwith_class;
using asp.netconnectionwith_class.connection;

namespace asp.netconnectionwith_class.connection
{
    
    public class business

    {
        connection.addconnection Objcon = new connection.addconnection();
       
        public DataSet  display()
        {
           
            SqlConnection con;
            con = Objcon.Dbconnection();  
            try
            {
                SqlCommand cmdin = new SqlCommand("dispvalue", con);
                cmdin.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter dAd = new SqlDataAdapter(cmdin);
                DataSet dSet = new DataSet();
                con.Open();
                dAd.Fill(dSet);
                return dSet;//.Tables["stud_info"];when use datatable
            }
            catch
            {
                throw;
            }
            finally
            {
                con.Close();
            }

        }
                       
        public int insertintotable(int id , string nm)
        {
            SqlConnection str;
            str = Objcon.Dbconnection();  

            int i = 0;
            try
            {
                str.Open();
                SqlCommand insertcommend = new SqlCommand("insertintotable", str);
               insertcommend.CommandType = CommandType.StoredProcedure;
               insertcommend.Parameters.AddWithValue("@id",id);
                insertcommend.Parameters.AddWithValue("@stud_nm",nm);
              
              
                i = insertcommend.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            finally
            {
                
                str.Close();
            }
            return i;
        }
    }
}


Entity layer

using System;
using System.Data;
using System.Web;


using asp.netconnectionwith_class;

namespace asp.netconnectionwith_class.connection
{
    public class entity
    {

       public int _id;
        public int id
        {
            get
            {

                return this._id;
            }
            set
            {
                this._id = value;
            }
        }
       public  string _nm;
        public string nm
        {
            get{return this._nm;}
            set{this._nm= value;
            }
        }
    }
}


DataBase Layer

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Data.SqlClient;

using System.Web.UI.WebControls.WebParts;


namespace asp.netconnectionwith_class.connection
{
  
    public class addconnection
    {
        public SqlConnection  Dbconnection()
        {
          
            SqlConnection con=new SqlConnection(ConfigurationManager.ConnectionStrings["stud"].ConnectionString);
            return con;
        }

       
    }
}
IF you are using entity layer then it will be ntier else three tier architecture for connectivity in asp.net programming with c#. for understanding three tier architecture you need to create .cs file or we can say create class file in simple asp.net page.

c program Addition of two number using function with comments

c program Addition of two number  using function with comments

How to add two number using function in c language.
first include header files .
 This program is simple program in c language which is showing use of function to create in c  program and call that function for adding two numbers .in simple method we can do also but , by using function it makes easier .

#include<stdio.h> // header files

void main()    //start of main
{ //opening of main
  int first_number,second_number;      //declaration of two variable later which will store the values
  clrscr();
  printf("\n Enter 2 Number:"); //asking for enter the numbers
  scanf("%d %d",&first_number,&second_number);        //taking two numbers and storing  into variable first_number and second_number.
  printf("\Addition=%d",add(first_number,second_number));   calling function add()
}   //closing of main


  int add(int x,int y) //function add
  {
    return(x+y);   //will give addition of two numbers
  } // close function




how to use viewstate in vb.net | store value in viewstate

how to use viewstate in vb.net | store value in viewstate


view state we use for using data from one function to another function  on same  .aspx page.
we can also use session but it would create burden on server .
because ViewState is client side state management so , after use once it would be destroyed.
won't create burden on server.
we can use same type of idea in c# and vb.net . so , even syntax is same.
    ViewState("definevaluewherewewanttostoreviewstatevalue") = thevaluewewanttostore

    Protected Sub buttonbind_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttonbind.Click
        Dim sql As String = "select * from stud"
        Dim cmd As SqlCommand = New SqlCommand(sql, con)
        Dim da As New SqlDataAdapter(cmd)
        Dim dt As New DataTable
        da.Fill(dt)
        Dim ds As New DataSet
        ds.Tables.Add(dt)
        Dim sql1 As String = "select * from stud where id=1"
        Dim cmd1 As SqlCommand = New SqlCommand(sql1, con)
        Dim da1 As New SqlDataAdapter(cmd1)
        Dim dt1 As New DataTable
        da1.Fill(dt1)
        ds.Tables.Add(dt1)
        ViewState("ds") = ds  'storing dataset values into ds variable.

    End Sub

    Protected Sub buttondiaplsy_Click(ByVal sender As Object, ByVal e As EventArgs) Handles buttondiaplsy.Click
        Dim dsdisplay As New DataSet
        dsdisplay = ViewState("ds") 'storing ds variable value onto another variable in another buttonclick event.

    End Sub

Saturday 17 November 2012

begin transaction | rollback transaction | how to retrieve deleted data | sql server 2008

begin transaction  | rollback transaction | how to retrieve deleted data | sql server 2008

how to rollback deleted query in sql server .
how to retrieve deleted | updated data in sql server by using rollback and begin transaction .
sometimes we think if i will delete that particular row then where it will effect.
specially when you are working on live project then it will give more impact.
so ,in this article i have shown how to retrieve deleted data with help of transaction and rollback in sql server 2005 | 2008.

SELECT * FROM STUD --it will give table data
id name
1 dev
2 deva
4 deva
5 deva
6 deva
8 "dsouza"
8 "d-souza"
 now i want to delete record where id=4 and after deletion i want to retrieve it .
then , what to do.
just write the query .

begin transaction 

delete from stud where id =4

(1 row(s) affected)

now check whether data deleted or it exists.

SELECT * FROM STUD
1 dev
2 deva
5 deva
6 deva
8 "dsouza"
8 "d-souza"


record is deleted .now i want to back fourth record what i will do , i will just write rollback .
rollback transaction
Command(s) completed successfully.


SELECT * FROM STUD
1 dev
2 deva
4 deva
5 deva
6 deva
8 "dsouza"
8 "d-souza"
here is your  record.but don't forget to use begin transaction  at the time of deletion of record.
else , it Will be difficult  to retrieve data again .

top query in sql server | select top 1*

top query in sql server | select top 1*

How to use and write top query in sql server | My sql | Oracle
top query will be same in every database but  thing is that to know about table name and field of particular table.


select * from stud 

1 dev
2 deva
4 deva
5 deva
6 deva
8 "dsouza"
8 "d-souza"


Now I want to select one row using top .
select top 1* from stud

1 dev


Now I want to select last record using top.
select top 1* from stud order by name
8 "d-souza"

now its time to work something real means if i want to select 5th record in table where
there is  more than 100 or 8 record.
so , we have to use subquery for that and  create one  Instance table


SELECT TOP 1  FROM
(SELECT TOP 5 * FROM stud ORDER BY id ASC) AS LAST
ORDER BY id DESC

6 deva

what i did over here step first ..
i wrote top 5 * query so it will select top 5 records

SELECT TOP 5 * FROM stud ORDER BY id ASC
1 dev
2 deva
4 deva
5 deva
6 deva

i will get output like this.
now after that i want 5th record so i did top 1 * from table by creating  instance of table AS LAST.
using top you can select  5th record from  bottom or top.but you should know about syntax else it will give error .

Tuesday 13 November 2012

Even | Odd number | 1 to 10 ..n | vb.net source code

Even | Odd number | 1 to 10 ..n | vb.net source code


Even number is a number which is divisible by 2 .
Odd number is number which is not divisible by 2.
lets take examples.
4 /2=2.
when we divide number 4 to number 2 it will not gives remainder so four is Even number .
second examples is 5 divided by 2 i.e 5/2 remeainde will be 1.so 5 is odd number.
in this program it shown to create function in vb.net and call that function in any event like
button click event.
   
Public Sub even_number()
        Dim takeval As Integer = txtVal.Text

        Dim first As Integer = 0
        While first < takeval
            If (takeval Mod 2) = 0 Then


                Response.Write(takeval)

            Else
                Response.Write("<br/> ")

            End If
            takeval -= 1
        End While

    End Sub

Swap values of two variables using call by value | output | comments

Swap values of two variables using call by value | output | comments

How to write program to swap two numbers using call by value in c .
source code to swap two number .
void swap(int a,int b)
{
int temp;
temp=a;
a=b;
b=temp;
printf("\nValues of a and b within the function: %d %d",a,b);
}
int main()

{
int a,b;
//Accept value of a & b
printf("\nEnter value of a:");
scanf("%d",&a);
printf("\nEnter value of b:");
scanf("%d",&b);
//print values before calling swap function
printf("\nValues of a and b before calling the function: %d %d",a,b);
//Calling swap function
swap(a,b);
//print values after calling the swap function
printf("\nValues of a and b after calling the function: %d %d",a,b);
}

sscanf() function | c program | string

sscanf() function | c program | string


This function is same as scanf() function but it reads from string rather than standard input.
/*Program to illustrate the use of sscanf() function*/
Include header file
int main()
{
//declare two strings
char s1[20]="1234";
char s2[20]="345.67";
//declare int and float variables
int n;
float f;
//convert the variables into string
sscanf(s1,"%d",&n);
sscanf(s2,"%f",&f);
//print the converted strings
printf("Value of n=%d\nValue of f=%f\n",s1,s2);
}

sprintf() function | c program | source code

sprintf() function | c program | source code


c program sprintf() function use in program with source code.

This function is same as printf() function but it sends the formatted output to a string instead of screen.
So we can convert a variable data type into string using sprintf() function.

/*Program to illustrate the use of sprintf() function*/

include header file
int main()
{
//declare two strings
char s1[20];
char s2[20];

//declare int and float variables

int n=7890;

float f=2345.67;
//convert the variables into string
sprintf(s1,"%d",n);
sprintf(s2,"%0.1f",f);
//print the converted strings
printf("s1=%s,s2=%s\n",s1,s2);

}

how to swap two values in c program | call by reference in c code

how to swap two values in c program  | call by reference in c code

swap values of two variables using call by reference comments
How to write C Program to swap values of two variables using call by reference
include header files


//function to swap values
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
printf("\nValues of a and b within the function: %d %d",*a,*b);
}


int main()
{
int a,b;
//Accept value of a & b
printf("\nEnter value of a:");
scanf("%d",&a);
printf("\nEnter value of b:");
scanf("%d",&b);
//print values before calling swap function
printf("\nValues of a and b before calling the function: %d %d",a,b);
//Calling swap function
swap(&a,&b);
//print values after calling the swap function

printf("\nValues of a and b after calling the function: %d %d",a,b);
}

How to write C Program to calculate L.C.M and G.C.D of two numbers using function

How to write C Program to calculate L.C.M and G.C.D of two numbers using function

Program source code
.first of all create two function first function gcd to find out gcd() and next lcm().
we need to pass two parameter  in given function .

void gcd(int,int); // created function for gcd
void lcm(int,int); // created function for lcm
int main()
{
int a,b;
printf("Enter two numbers: \t");
scanf("%d %d",&a,&b);
lcm(a,b);
gcd(a,b);
return 0;
}


//function to calculate l.c.m
LCM=Least Common Multiple or lowest common multiple

How to find  LCM of 3 and 5 by manually  .
Multiples of 3 are 3,6,9,12,15,18 etc..


and the multiples of 5 are 5,10,15,20, etc... 15 is common in both case.
so lcm of 3 and 5 is 15.

void lcm(int a,int b)
{
int m,n;
m=a;
n=b;
while(m!=n)
{
if(m
m=m+a;
else
n=n+b;
}
printf("\nL.C.M of %d & %d is %d",a,b,m);
}

//function to calculate g.c.d
GCD =Greatest common divisor , One number divides two number like
12  and 20 is divisible by 4 ,
hence gcd of 12 and 20 is 4.
void gcd(int a,int b)
{
int m,n;
m=a;
n=b;
while(m!=n)
{
if(m>n)
m=m-n;
else
n=n-m;
}
printf("\nG.C.D of %d & %d is %d",a,b,m);

Void Pointer example in c language

Void Pointer example in c language

 How to use of void pointer in c language
include header files
main()
{
int a=10,*j;
void *k;
j=k=&a;
j++;
k++;
printf("\n %u %u ",j,k);
}
Explanation:

Void pointers are generic pointers and they can be used only when the type is not known and as an intermediate address storage type.
No pointer arithmetic can be done on it and you cannot apply indirection operator (*) on void pointers.

array in c program | Array example with Explanation

array in c program  | Array example with Explanation

Array in cprogramming
/*Array in c program with code*/

include header file
main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);

}

Explanation:
As we know array name is the base address for that array. Here s is the base address and i is the index number/displacement from the base address. So, in directing it with * is same as s[i]. i[s] may be surprising.
 But in the case of C it is same as s[i].

Token pasting operator in c language with program source code.

Token pasting operator in c language with program source code.


/* use of token pasting operator with Output */
//Token pasting operator is used to concatenate two tokens into a single token.
with program source code.


#define PASTE(a,b) a##b
#define MARKS(sub) marks_##sub
int main()
{
int k1=15,k2=60;
int marks_os= 95;
int marks_ds=99;

//converting statement below to printf("%d %d",k1,k2)

printf("%d %d ",PASTE(k,1),PASTE(k,2));

//converting statement below to printf("%d %d",marks_os,marks_ds)
printf("%d %d ",MARKS(os),MARKS(ds));
}

Nesting of macros | check alphabet using ISALPHA | Program code

Nesting of macros | check alphabet using ISALPHA | Program code

Nesting of macros in c language with output.
How to write code for nesting of macros in c language.
By using if and else condition we can check whether entered value is alphabet or not.
simply by using ISALPHA Keyword.
ISALPHA will check about the alphabet or not.
 include header ....
 #define ISLOWER(c) (c>=97&&c<=122)
 #define ISUPPER(c) (c>=65&&c<=90)
 #define ISALPHA(c) ISLOWER(c) || ISUPPER(c)
int main()  // starting of main
{
char chr;
printf("Enter a character:\n"); // taking value from user
scanf("%c",&chr);  
if (ISALPHA(chr) ) // cheking condition
{
printf("%c is an alphabetical character.\n",chr);
}
else  // going in else part
{
printf("%c is not an alphabetical character.\n",chr);
}
return 0;
}

Sunday 11 November 2012

perfect number in vb.net from 1 to n | source code

perfect number in vb.net from 1 to n | source code
Number which is sum of its factors  like
factor of 6 is 1*2*3.
so 1+2+3=6
sum of factors is =number itself
hence 6 is perfect number .after that 28 is perfect number.
perfect number from 1 to 1000
is 6, 28, 496
Public Sub perfect()
        Dim takeval As Integer = txtVal.Text
        Dim valstore As Integer = 1
        Dim flag As Integer = 0
        Dim val2 As Integer
        Dim Sum As Integer = 0
        For val2 = 2 To (takeval - 1)
            valstore = 1
            Sum = 0
            While valstore < val2
                If (val2 Mod valstore = 0) Then
                    Sum = Sum + valstore
                End If
                valstore += 1
            End While
            If Sum = val2 Then
              Response.Write(Sum & "is perfect number")

            End If

        Next


    End Sub

Tuesday 6 November 2012

Prime Number between 1 to n | program code | simple prime number code

Prime Number between 1 to n | program code | simple prime number code
Prime Number series in vb.net with source code .
in this program i have shown how to write program for
prime number in vb.net using for loop and if .
it is very simple to find out single prime number  but when we comes across prime number
series then its challenge.
in this program i will tell you how to get prime number from 1 to 10 or 1 to n with comments.
just stick with this code later on i will show execution line by line by video

   Public Sub Primenumber()
        Response.Write("Prime number ")
        Dim takeval As Integer
        Dim flag As Integer
        flag = 0
        takeval = txtVal.Text
        Dim i As Integer
        Dim j As Integer
        For i = 2 To takeval

            For j = 2 To (i - 1)

                If i Mod j = 0 Then
                    flag = 0
                    Exit For

                Else

                    flag = 1
                    'Exit For
                End If
            Next j
            If flag = 1 The    
           Response.Write(i)
                Response.Write("</br>")
            End If
        Next i
    End Sub


3 5 7 'will show prime number  between 1 to 10.
you can call primenumber function on button click event also.

Sunday 4 November 2012

Thursday 25 October 2012

CRYSTAL REPORT IN VB.NET WITH PARAMETER DATASET

CRYSTAL REPORT IN VB.NET WITH PARAMETER DATASET
Imports System.Data.SqlClient
Imports System.Data
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Enterprise
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource

Partial Class _Default
    Inherits System.Web.UI.Page
    ' Dim ClientReport As New ClientReport()
    Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("client").ConnectionString)
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub







    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    
        Dim cmd As New SqlCommand("select_report", con)

        Dim code As String
        Dim dt As New DataTable

        code = txttakenumber.Text
        cmd.Parameters.AddWithValue("@hld_ac_code", code)
        dt = GetDataItem("select_report", CommandType.StoredProcedure, "select_report")
        Dim rpt As New ReportDocument
        rpt.Load("E:\Websites\parameter\ClientReport.rpt")
        CrystalReportViewer1.ReportSource = rpt
        CrystalReportViewer1.RefreshReport()





      



    End Sub

    Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
        Dim ds As New DataSet
        Dim dt As New DataTable

        '  Dim code As String
        con.Open()
        Dim cmd As New SqlCommand("select_report ", con)
        cmd.CommandType = CommandType.StoredProcedure
        Dim i As String
        Dim dat As Integer
        dat = 20090711
        'code = txttakenumber.Text
        Dim da As New SqlDataAdapter(cmd)
        cmd.Parameters.AddWithValue("@hld_hold_date", dat)
        i = cmd.ExecuteNonQuery()
        da.Fill(dt)


        ds.Tables.Add(dt)
        CrystalReportViewer1.EnableDatabaseLogonPrompt = False
        Dim rpt As New ReportDocument
        rpt.Load("E:\Websites\parameter\ClientReport.rpt")
        rpt.SetDataSource(dt)
        CrystalReportViewer1.ReportSource = rpt
        Response.ClearContent()
        Response.ClearHeaders()
        con.Close()


    End Sub

    Protected Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
        CrystalReportViewer1.Dispose()
    End Sub
End Class

Wednesday 24 October 2012

crystal report import

crystal report  import
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Enterprise
Imports CrystalDecisions.Web
Imports CrystalDecisions.Shared
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub displayBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayBtn.Click
        Dim rpt As New ReportDocument

        rpt.Load("E:\Users\dev\Documents\Visual Studio 2008\WebSites\report\CrystalReport.rpt")
        CrystalReportViewer1.ReportSource = rpt
        CrystalReportViewer1.RefreshReport()

    End Sub
End Class

Wednesday 17 October 2012

crystal report designing using c#

crystal report designing using c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FinancialEntityLayer;
using FinancialBusinessLayer;
using Financial_Application.Utiltiy;
using System.Data.Common;
using System.Data;
using System.Drawing.Design;
using System.Drawing.Imaging;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Web.Design;
namespace Financial_Application.Reports
{
    public partial class Reports : System.Web.UI.Page
    {
        FinancialBusinessLayer.Report objBL = new FinancialBusinessLayer.Report();
       FinancialEntityLayer.Report objEL = new FinancialEntityLayer.Report();
        ///DataSet ds;
      ClientReport c = new ClientReport();

        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void CrystalReportViewer1_Init(object sender, EventArgs e)
        {
            DataSet dsrpt = new DataSet();

            try
                {
                  
                DataTable dt;
                dt = objBL.GetEntity();
                dsrpt.Tables.Add(dt);
                DataTable dt1;
                FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Session["Assign"];
                dt1 = objBL.GetEntityClientInfo(objEL);
                dsrpt.Tables.Add(dt1);
              
             
                //DataTable dt2;
                //dt2 = objBL.GetEntityClientisin(objEL);
                //dsrpt.Tables.Add(dt2);

                CrystalReportViewer1.EnableDatabaseLogonPrompt = false;               
                c.SetDataSource(dsrpt);              
                CrystalReportViewer1.ReportSource = c;
                Response.Buffer = false;             
                Response.ClearContent();
                Response.ClearHeaders();

             
                if(dt.Rows.Count==0 || dt1.Rows.Count==0)
                {
                    lblError.Text = "Record Not Found";
                  
                }
                    else
                   {

                    Session["Ft"] = Session["Format"].ToString();
                    if (Session["Ft"] != null)
                    {
                        lblError.Text = Session["Ft"].ToString();
                        if (lblError.Text == "Pdf")
                        {
                            c.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Client Report");
                        }

                        if (lblError.Text == "Excel")
                        {
                            c.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Client Report");
                        }
                        if (lblError.Text == "Text-File")
                        {
                            c.ExportToHttpResponse(ExportFormatType.RichText, Response, true, "Client Report");
                        }
                        if (lblError.Text == "Browser")
                        {
                           // ClientReport cr = new ClientReport();
                            string contentType ="";
                            contentType = "text/html";
                           contentType = "true";
                            c.ExportToHttpResponse(ExportFormatType.HTML32, Response, true, "Client Report");
                           
                           

                        }
                     }   
                    else
                    {
                       c.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Client Report");
                    }
                }
                }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }                 
        }
        protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
        {
            CrystalReportViewer1.Dispose();

        }
     

    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FinancialDatabaseLayer;
using FinancialEntityLayer;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;


namespace FinancialBusinessLayer
{
    public class Report
    {

        public DataTable GetEntity()
        {
            DataTable dt;
            try
            {
                FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
                //FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
               // objDB.AddParameter("@cum_courrier_id", objEL.IntCourrier_id);
               // objDB.AddParameter("@Mode", objEL.StrMode);

                dt = objDB.getDataTable("usp_Client_Report", System.Data.CommandType.StoredProcedure,"Entity_master");
            }
            catch
            {
                dt = null;
            }
            return dt;
        }



        public DataTable GetEntityClientInfo(object Parameter)
        {
            DataTable dt = null;
            try
            {
                FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
                FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
                objDB.AddParameter("@client_id_from", objEL.ChrClFrom);
                objDB.AddParameter("@client_id_to", objEL.ChrClTo);
                objDB.AddParameter("@cm_groupcd", objEL.ChrGrp);
                objDB.AddParameter("@family", objEL.ChrFm);
                objDB.AddParameter("@branch", objEL.ChrBranch);
               objDB.AddParameter("@isin", objEL.ChrIsin);
                dt = objDB.getDataTable("usp_client_master_search_on_multiple_value", System.Data.CommandType.StoredProcedure, "Client_master");

            }
            catch
            {
                dt = null;
            }
            return dt;
        }




        public DataTable GetEntityClientisin(object Parameter)
        {
            DataTable dt = null;
            try
            {
                FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
                FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
              
                objDB.AddParameter("@isin", objEL.ChrIsin);
                dt = objDB.getDataTable("usp_single_clientSmart_binding", System.Data.CommandType.StoredProcedure, "Client_master");

            }
            catch
            {
                dt = null;
            }
            return dt;
        }
        //public DataSet GetEntityClientInfo(object Parameter)
        //{
        //    DataSet dt = null;
        //    try
        //    {
        //        FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
        //        FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
        //        objDB.AddParameter("@client_id_from", objEL.ChrClFrom);
        //        objDB.AddParameter("@client_id_to", objEL.ChrClTo);
        //        dt = objDB.ExecuteDataSet("usp_client_master_search_on_multiple_value", System.Data.CommandType.StoredProcedure);
        //    }
        //    catch
        //    {
        //        dt = null;
        //    }
        //    return dt;
        //}


        //public DataTable GetIsin(object Parameter)
        //{
        //    DataTable dt;
        //    try
        //    {
        //        FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
        //        FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
        //        objDB.AddParameter("@Isin",objEL.ChrIsin);
        //        // objDB.AddParameter("@Mode", objEL.StrMode);

        //        dt = objDB.getDataTable("usp_Report_Isin", System.Data.CommandType.StoredProcedure, "Entity_master");
        //    }
        //    catch
        //    {
        //        dt = null;
        //    }
        //    return dt;
        //}

        public DataSet binddlScheme(object Parameter)
        {
            DataSet ds;
          
                FinancialDatabaseLayer.DataBase objDB = new DataBase(ConfigurationManager.ConnectionStrings["FinancialConnectionString"].ConnectionString);
                FinancialEntityLayer.Report objEL = (FinancialEntityLayer.Report)Parameter;
                objDB.AddParameter("@Mode",objEL.StrMode);
                ds = objDB.ExecuteDataSet("usp_Single_EntityReportBinding", System.Data.CommandType.StoredProcedure);
         
            return ds;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FinancialEntityLayer
{
    public class Report
    {
        public string StrMode
        { get; set; }
        public char[] ChrClFrom
        { get; set; }
        public char[] ChrClTo
        { get; set; }
        public char[] ChrGrp
        { get; set; }
        public char[] ChrSb
        { get; set; }
        public char[] ChrFm
        { get; set; }
        public char[] ChrIsin
        { get; set; }
        public char[] ChrSet
        { get; set; }
        public char[] ChrBranch
        { get; set; }
    }
}

TAKE clientreport.rpt and drag n drop fields

Saturday 1 September 2012

No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputText to a known managed provider native type.

No mapping exists from object type System.Web.UI.HtmlControls.HtmlInputText to a known managed provider native type.
    cmd.Parameters.Add("@stud_rollno", txtstudroll);
              cmd.Parameters.Add("@paidfee", txtpaid);
              cmd.Parameters.Add("@remain_fee", txtremain);

that is incorrect that why you are getting error like that.
now to corect it

cmd.Parameters.AddWithValue("@stud_rollno", txtstudroll.Value);
               cmd.Parameters.AddWithValue("@paidfee", txtpaid.Value);
               cmd.Parameters.AddWithValue("@remain_fee", txtremain.Value);

cmd.Parameters.AddWithValue | insert record in asp.net

  cmd.Parameters.AddWithValue | insert record in asp.net
  cmd.Parameters.AddWithValue | insert record in asp.net
try
           {
               con.Open();
               //SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(8,456,555)",con);
               SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(@stud_rollno,@paidfee,@remain_fee)", con);
               cmd.CommandType = System.Data.CommandType.Text;
               cmd.Parameters.AddWithValue("@stud_rollno",9);
               cmd.Parameters.AddWithValue("@paidfee",233.4);
               cmd.Parameters.AddWithValue("@remain_fee",4565.34);
               cmd.ExecuteNonQuery();
              //DataTable dt = new DataTable(); 
           }
           catch(Exception ex)
           {
               Response.Write(ex);
           }


            finally
            {
               con.Close();
            }

insert record in asp.net simple program with c#

insert record in asp.net simple program with c#
insert record in asp.net simple program with c#
try
           {
               con.Open();
               SqlCommand cmd = new SqlCommand("insert into feesentry_tb (stud_rollno,paidfee,remain_fee)values(8,456,555)",con);
              // cmd.CommandType = System.Data.CommandType.Text;
              cmd.ExecuteNonQuery();
             
              
               //DataTable dt = new DataTable();
              
              
           }
           catch(Exception ex)
              {
              
               Response.Write(ex);
           }
           finally
           {
               con.Close();
           }