-->

Wednesday, May 6, 2015

Demerits of bottom-up technique in c language

In my previous article i explained about:

  1. Features of top-down technique
  2. Merits of bottom-up technique
Now, today i will learn about Bottom up technique demerits:

  • The application developed using this technique cannot be tested as a whole before the development of main solution.
  • The sub-solutions are added or linked to the main solution without knowing the details of its coding.
  • The design of the sub-solutions are coded without the idea of their linking in the main solution.
  • The integration testing may cause complications because it is done in the later stage of application development.
You may also learn about : Top Down Technique

Friday, May 1, 2015

fseek( ) method in C language

In order to access the file directly the file handling function fseek( ) is used. Access is nothing but to seek. So, it is easy to remember the function for direct access. The syntax of the function fseek( ) is as follows:

int fseek( FILE *fp, long offset, int whence)

Where:
fp is the file pointer
offset is the number of bytes to skip
whence can be replaced with SEEK_SET- from beginning
                                                SEEK_CUR- from current position
                                                SEEK_END - from the end
This position repositions the file or record pointer from the whence position by offset bytes on the file stream fp. The function returns 0 on success or non-zero on unsuccessful.

The following program gives the idea of using the fseek( ) function.

/* Program to display the details of the students using fseek( ) in the binary file "studb.dat" */

#include<stdio.h>
#include<conio.h>
#include<process.h>
main ( )
{
struct Stud
{
int rollno, marks[5];
char fname[25];
float avg;
};
typedef struct Stud STUDENT ; /* renaming the data type struct Stud to Student */
int idx;
FILE *fp;
STUDENT s; /* s is the structure variable to read/write student's data */
fp = fopen("studb.dat","rb"); /* Read mode to scan the records from the binary file "studb.dat" */
if(fp == NULL)
{
printf("File opening error....");
exit(1);
}
clrscr( );       /* To clear the screen and to display heading */
printf("%4s%27s","RNo","FName");
printf("%7s%7s%7s%7s%7s","Marks1","Marks2","Marks3","Marks4","Marks5");
printf("%9s\n\n","Avg");
fseek(fp,2*sizeof(s),SEEK_CUR);  /* to remove to 3rd record */
fread(&s,sizeof(s),1,fp);  /* to read 3rd record directly */
if(feof(fp))
exit(1);  /* To come out of the loop, at the end of the file */
printf("%4d %26s",s.rollno,s.fname); /* Data is displayed on the screen */
for(idx=0;idx<5;idx++)
printf("%6d",s.marks[idx]);   /* Next set of Data is displayed */
printf("%8.2f \n",s.avg);  /* Avg is displayed and new line generated for the next record */
fclose(fp);
}

Online job website project in asp.net c#

Introduction

Online Job website site provide the functionality to search new jobs online according to candidates eligibility in various fields. This web site helps to find new recruits in governmental and private sector day by day with latest openings. This site is also very helpful for freshers to find job because on this site, we are specially working to meet new recruiter and candidates as per their requirements.


Project description:

When we open the project first time in the browser, home page appeared which is contain lots of things like Header part, Navigation bar, body part and last one is footer part.

Online job weebsite project in asp.net c#


A header part of the project contains: (According to above mentioned snap)

  • Welcome message for both guest and authenticated user.
  • Sign-In and Signup options
Now come to navigation part, its contain : (According to above mentioned snap)
  • Home page links 
  • Search jobs via Job Name, salary wise, etc.
  • Employer Zone
  • Contact us page
  • Feed Back System
Now, click to any letters which is mentioned in the search job option. After that you will see a table, in which we have JobId, JobName, and Salary.

Download 

mail me  : narenkumar851@gmail.com


Thursday, April 30, 2015

How to use SQL LIKE operator in asp.net c#

Today when we wrote a program for online job portal. On that time i want to show the job detail from job table using single English alphabet letter. So first of all i bind Dropdownlist with the alphabet letters then also bind Gridview from selected DropdownList letter. For this type of query i need SQL LIKE operator because i want to search items from the table on the basis of selected letter.  Bind the gridview with SqlDataSource with where clause.

 <p>
        Please Select any one letter from given list:</p>

    <asp:DropDownList ID="Letters" DataSource='<%# Alphabet %>' runat="server" />

    <asp:Button ID="Button1" runat="server" Text="Get Job List"  />
<p>


        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="JobId" DataSourceID="SqlDataSource1">

            <Columns>

                <asp:BoundField DataField="JobId" HeaderText="JobId" InsertVisible="False" ReadOnly="True" SortExpression="JobId" />

                <asp:BoundField DataField="JobName" HeaderText="JobName" SortExpression="JobName" />

                <asp:BoundField DataField="Salary" HeaderText="Salary" SortExpression="Salary" />

                <asp:HyperLinkField DataNavigateUrlFields="JobId" DataNavigateUrlFormatString="jobdetail.aspx?JobId={0}" HeaderText="Full Detail" Text="Details" />
            </Columns>

        </asp:GridView>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [AddJob] WHERE (JobName LIKE @JobName + '%')">

            <SelectParameters>
                <asp:ControlParameter ControlID="Letters" Name="JobName" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>

Code Behind page

public partial class Bynamejobsearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataBind();
        }
    }
    private List<char> _Alphabet;
    protected List<char> Alphabet
    {
        get
        {
            if (_Alphabet == null)
            {
                _Alphabet = new List<char>();
                for (int i = 65; i < 91; i++)
                {
                    _Alphabet.Add(Convert.ToChar(i));
                }
            }
            return _Alphabet;
        }
    }

}

Code generate the following output:

How to use SQL LIKE operator in asp.net c#


Dark highlighted black line show that how to use select command with like operator. By using LIKE operator we got job detail which is start from letter which is selected in DropdownList. I mean to say first letter come from List and remaining letter can any other letters of English alphabet.

Tuesday, April 28, 2015

How to bind Dropdownlist with whole english characters in ASP.NET C#

I want to say that how to add English alphabets at run time in DropdownList. A intermediate programmer know that each char contain a ASCII value like 65 is a ASCII value of letter 'A'. Similarly again 66 to 90 is a ASCII value of Letter B to Z.  So add a DropdownList in the design page also bind with Alphabet public property. Look like this:

Source page:
<asp:DropDownList ID="Letters" DataSource='<%# Alphabet %>' runat="server" />

Code Behind Page:
public partial class Bynamejobsearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataBind();
        }
    }
    private List<char> _Alphabet;
    protected List<char> Alphabet
    {
        get
        {
            if (_Alphabet == null)
            {
                _Alphabet = new List<char>();
                for (int i = 65; i < 91; i++)
                {
                    _Alphabet.Add(Convert.ToChar(i));
                }
            }
            return _Alphabet;
        }
    }
}
In this program i have a list of type char. Use for loop which is start from 65 to 90. Add this char in the list one by one.
How to bind Dropdownlist with whole english characters in ASP.NET C#

Monday, April 27, 2015

Creating a Database in SQL Mgt Studio 2012

Creating a Database is to occupy some space in physical drive for the records saving through the application. These saved records can easily be listed or modified as per user’s requirement. To perform operations like add/edit/delete on these records a person used to create some application having capability of doing so. In earlier article, we have installed SQL Server Management Studio 2012 following some easy steps. This time we will establish a connection with server and create a database EmpDb having only a single table Employee. Start Management studio through all programs or whatever shortcut you have on your system and follow these steps.
  1. First screen will prompt you to establish a connection with server requiring some values as      SQL Server Management Studio
  2.        
  3.  below: Just write (LocalDb)\v11.0 because i have only local db installed in my system, you can change as per your server installation.
  4. On the left side there are some options "Database, Security, Replication, Management" are pre-added. Right click on Database and select New Database, a window will show as below prompting database name:                                                                                                                
    New Database in SQl server management studio
  5. Enter database name "EmpDb" and click on Ok button, it will create a new database with none of tables, views. Now look out the server connection there is a new entry of your database as shown:                                                                                                                                              
    Enter database name "EmpDb
  6. Right click on tables and select New Table, it will show you editor having three columns name, data-types and nullable. Write some columns with their data-types, don’t forgot to make Id a primary key and Identity set to true. Identity property will auto-increment this columns according to data entry. Save this table and enter name “Employee”. You can see the columns and their data-types in the below image:                                                                                          
    New Table in sql server
Your database have easily been created with a single table and some columns. In the next article we create an edmx file for this database to be used for MVC application and will perform operation on this database.

Saturday, April 25, 2015

Nested Gridview example in asp.net c#

Before we talk about nested gridview asp.net c#. First we talk about gridview control. It is a data source control through which we can bind data in the form of table. In this article, we will take two gridview asp.net controls and we will arrange both control in this way, please see the mentioned picture.

Lets to start how to design it

  1. First to add asp.net gridview in the source page
  2. Add a <Columns> tag inside it.
  3. Add single column inside it using TemplateField with HeaderText property, if you want to add more than one column then add equal number of TemplateField inside it.
  4. Show the data in the browser with the help of ItemTemplate, so add it inside Template Field.
  5. Now, the article's main point is here, Add another gridview asp.net controls inside the ItemTemplate, Now your code look like:
     <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
     <Columns>
    <asp:TemplateField HeaderText="Subject Marks">
     <ItemTemplate>
     <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false">
     </asp:GridView>
     </ItemTemplate>
    </asp:TemplateField>
     </Columns>
     </asp:GridView>
  6. Similarly again, repeat the step 2 to 4 for second nested gridview asp.net control. Now, add three columns by using Template Field.
  7. Bind all columns inside the ItemTemplate field of second gridview control, Please see the full code which is mentioned below:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">

<Columns>

<asp:TemplateField HeaderText="Subject Marks">
<ItemTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Hindi">
<ItemTemplate>
<asp:Label ID="hindilabel" runat="server" Text='<%# Eval("hindi") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Maths">
<ItemTemplate>

<asp:Label ID="mathslabel" runat="server" Text='<%# Eval("maths") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="English">
<ItemTemplate>

<asp:Label ID="englishlabel" runat="server" Text='<%# Eval("English") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
© Copyright 2013 Computer Programming | All Right Reserved