Thursday 3 August 2017

SQL Server output parameter


Output Parameter

Store procedure is a set of some sql statement which saved on server. Store procedure takes argument for database operation which is known parameter. There are two type of parameter.

Input parameter

When user provides a value as parameter and passes to store procedure.

Output Parameter

When user hold something returns from store procedure through parameter known as output parameter.

Advantage

  • Decrease complexity because it help you to do more than one task in single procedure
  • when inserting data to a table and you need to get the identity value back
  • when perfoming select statements and you need some extra data,
  • when updating or inserting data and you need some way to know if the operation was successful
  • for most if not all of the reasons you need out or ref parameters in c#




Store Procedure

USE [Girfa]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[pcheck]
(
@id bigint,
@phone varchar(15) output
)

as
as


select @phone= MobileNo from dbo.UserMaster where UserId=@id

C# Code

UserModel ob = new UserModel();

try

 {

    using (SqlConnection dbCon = new  SqlConnection(ConfigurationManager.ConnectionStrings["dbConnection"].ToString()))

    {

 

        using (SqlCommand cmd = new SqlCommand("[dbo].[pcheck]", dbCon))

        {

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@id", Convert.ToInt32(id));

            cmd.Parameters.Add("@phone", SqlDbType.VarChar, 30);

            cmd.Parameters["@phone"].Direction = ParameterDirection.Output;

            if (dbCon.State == ConnectionState.Closed)

                    dbCon.Open();

            cmd.ExecuteNonQuery();

            b.MobileNo = Convert.ToString(cmd.Parameters["@phone"].Value);

        }

 

     }

}

catch (Exception ex)

{

              

}

 

return ob;




Wednesday 2 August 2017

Passing Array to function


Q : Write a function which accepts an array of size n containing integer values and returns average of all values. Call the function from main program.

Solution :


#include<stdio.h>
#include<conio.h>
int avg(int[],int);
void main()
{
     int ar[5],i;
     clrscr();
     for(i=0;i<5;i++)
     {
          printf("Enter %d number

Write a program to bonus calculation using structure

Q : Write a C program to store the employee details with the following attribute?



Sr No.
Basic Salary
Sales Percentage
Bonus Amount
1
<=7000
<=10
1500
2
<=7000
>=10
3000
3
>7000 and <=15000
<=10
2000
4
>7000 and <=15000
>=10
4000
5
>15000
<=10
2500
6
>15000
>=10
4500

Solution : 


/* ============================================
          Girfa Student Help
          Program : Salary Calculation
          For more program visit :http://girfahelp.blogspot.in/p/c-language-structure-programming.html
================================================*/
#include<stdio.h>
#include<conio.h>
typedef struct stu
{
     int empid;
     int pf;
     int mediclaim;
     int basicsal;
     int sp;

Monday 31 July 2017

File Extension Check

<html>
<head>
    <title>Girfa : Student Help</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
        function filecheck()
        {
            var extension = $('#file').val().split('.').pop().toLowerCase();

            if ($.inArray(extension, ['png', 'jpg', 'jpeg']) == -1) {
                alert('Sorry, invalid extension.');
               
            }
            else
                alert('ok Fine');

Saturday 29 July 2017

Autocomplete


autocomplete-jquery





Download Source Code
Next Topic



Thursday 27 July 2017

M3-R4 ‘C’ LANGUAGE July, 2014 Solved

M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH ‘C’ LANGUAGE July, 2014 Solved


1. Multiple Choice

1.1 : B
Explanation : void is used to indicate that a function will not be return any data to calling function. You should also use void in place of argument for when function does not takes argument but it’s optional.
If you left blank of return type then int will be consider as default return type of given  function. 

1.2 : C
1.3 : B
Explanation : Name of an array is constant pointer which point first element when 5 added to pointer then it jump 5 places to forward direction.

Write a program to copy a file into another file.

Q : Write a program to copy a file into another file.

Answer : 


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main(int argc,char *argv[])
{
     FILE *infile,*outfi

Sunday 23 July 2017

Assignment Software Project Management

Assignment 
Software Project Management 

Q1. What is Software Project management? Explain the activities of software project management.

Q2. Define the water fall model with its stages. Explain the advantages and disadvantages of water fall model.

Assignment Java programming

Assignment 
Java programming

1. Q-what do you understand by object oriented programming?
2. Q-what do you understand by applet explain with example?

Assignment OBJECT ORIENTED ANALYSIS AND DESIGN

Assignment 
OBJECT ORIENTED ANALYSIS AND DESIGN


 Q- What is object? Explain in details?

 Q- What is generalization in UML? Draw a state chart diagram of UML?

MULTIMEDIA AND ITS APPLICATION

MULTIMEDIA AND ITS APPLICATION 

Q.1- What are Natural resources?

Q.2- What are the problem of forestry in india?

Q.3- What are the causes of food grain problem?

Computer Graphics

Computer Graphics 

Q1. Explain the term computer Graphics. Explain the input and hardcopy devices.

Q2.Give the algorithm for scan conversion of circle using DDA method and midpoint algorithm

Assignment VB6.0

Assignment VB6.0


Q1. What do you understand by object oriented programming? Explain the different
Feature of the object oriented programming and how it is better than procedure oriented
Programming compare?
 Q2. What do you understand by data base management system? Explain five approaches
For connecting database with example using appropriate code.

Assignment Environmental studies.

Assignment
Environmental studies.

Q.1.- Describe the changes in forest cover in India?
Q.2- Write the short notes-

Assignment RDBMS ASSIGNMENT

Assignment
RDBMS ASSIGNMENT

Q1- What is codd’s Rule for RDBMS?
Q2- Write the short note on the given topic.

  • Foreign key
  • Primary key

Assignment Principles of Accounting

Assignment
Principles of Accounting

Q1. What is accounting? Define the advantages and limitation of accounting.
Q2.What is the Accounting Concepts? Define in brief.
Q3. What is accounting convention? Explain in detail all types of accounting conventions.
Q4. What is Journal and Ledger? Maintain journal and ledger for following

  •  Business started with Rs. 5,00,000
  •  Building sold rs. 50,000
  •  Furniture purchased rs. 10,000.
  •  salary paid rs. 5,000.
  •  Stationary purchased rs 10,000.

Assignment Data Communication and Network

Assignment
Data Communication and Network


1. What is Data Communication & What is Network?Define Communication Protocols and Transmission modes.
2. What is Aloha Protocol? Define FDM, TDM, and CDMA in detail.

Assignment Data Structure through C

Assignment
Data Structure through C

Q 1. What is data structure and what are the uses of data structure in computer science?
Q 2.What is difference between Single and Double link list?

Assignment Principle of management

Assignment
Principle of Management

Q.1-Explain “management as a science”?
Q.2-What is planning? what are its advantages?
Q.3-How Many Types of Co-ordination? Give Brief?

Assignment Operating System

Assignment
Operating System

Q1 what is operating system and its uses?
Q2. What is multiprogramming explain with example?