Wednesday 19 September 2012

Modal Question and Programming C Language

Practical Question paper of C Language

Loop


Miscellaneous

One Dimension Practical model question paper

Q 1. Write a  program to shift array element with previous one (Left-Sifting) . Last element will replace with first element ?

Q 2. Write a program to count even and odd number in an array?

Q 3.Write a program to make three array name mArry, even & odd move array value in even & odd array respect to this type ?

Q 4.Write a program to find smallest and highest number from an array?

Q 5. Write a program to print an array in reverse order?

Q 6. Write a program to print only consecutive number of an array?

Q 7. Write a program to implement union and intersection?

Q 8. Write a program to merge two array into a single array?

Q 9.Write a program to spilt an array into two equal parts ?

Q 10. Write a program to input Fibonacci into array?

Q 11.Write a program to find out prime number between given range and saved these number into array. Range should be up-to 1 to 10000 ?

Q 12.Write a program to input 10 numbers and print each element with multiply by its equivalent index position?

Q 13. Write a program to print an array value without using loop ?

Q 14.Write a program search a number in array ?

Q 15.Write a program to print an array value skip by one index?

Q 17. Write a program to input ASCII value and print its equivalent character.Using 7 bit ASCII/

One Dimension Character Array  Programs

1. Write a program to count Vowels and consonant?

2. Write a program to count no. of word in an array?

3. Write a program to convert lower case character into upper case

4. Write a program to print only consecutive appeared character

5. Write a program to implement concatenation?

6.  Write a program to implement substring function type functionality without using library function.

7. Write a program to input small letter if capital letter is there ignore that

8. Write a program accept any case input and convert it small case

9. Write a program input character only and display error message on any other input?

10. Write a program to search a substring and print its index

11. Write a program to search a word and reverse that

12. Write a program implement encryption i.e. change each character to two character forward. i.e.   A-> C,B->E

13. Write a program to implement following format
              G                                              GIRFA
              GI                                             GIRF
              GIR                                          GIR
              GIRF                                        GI
              GIRFA                                     G

14. Write a program to implement abbreviation i.e.
Input : Ashok Kumar Yadav
Output : A.K. Yadav

15. Write a program to implement find and replace all functionality

16. Write a program to check whether a string is palindrome or  not

17. Write a program reverse a string

18. Write a program to reverse each word into array

19. Write a program to input string password. i.e.(A Small and Capital character , A number and a special symbol)

20. Write a program to check validity of an email address. (an email can have only one @ symbol after that . is required and no space is allowed)

21. Write a program count frequency of each character individually.
22. Write a program to convert number to word?
   i.e.    123
            One Hundred Three Only


Prime Number

#include<stdio.h>
void main()
{
int i,j,k;
printf("Enter number>> ");
scanf("%d",&i);
j=2;
while(j<i)
{
if(i%j==0)
break;
j++;
}
if(i==j)
printf("Prime");
else
printf("Not Prime");
}

Reverse A number

#include<stdio.h>
void main()
{
int i,j,k,m=0;
printf("Enter number>> ");
scanf("%d",&i);
k=i;
while(i>0)
{
j=i%10;
i=i/10;
m=m*10+j;

}
printf("Reverse number is %d",m);
}
Armstrong Number

void main()
{
int i,j,k,m=0;
printf("Enter number>> ");
scanf("%d",&i);
k=i;
while(i>0)
{
j=i%10;
i=i/10;
m=m+j*j*j;

}
if(k==m)
printf("\nArmstrong");
else
printf("\nNot Armstrong");
}

Fibonacci Series


#include<stdio.h>
void main()
{
   int a,b,c;
  c=1;
  a=0;
  b=0;
   while(c<200)
   {
   a=b;
   b=c;
  c=a+b;
  printf("%d\t",a);
   }
}

Factorial number using Recursive function

       #include<stdio.h>
       int fact(int n)
      {
   if(n==0)
  return(1);
   else
  return(n*fact(n-1));
      }
      void main()
     {
    int a;
    printf("enter a number>> ");
    scanf("%d",&a);
    printf("\n\tFactorial=%d",fact(a));
    }
Print your name without using semicolon

     #include<stdio.h>
     void main()
    {
       if(printf("Hello Girfa"))
          {
          }
    }

Palindrome

A palindrome is a word, phrase, number, or other sequence of units that may be read the same way in either direction, with general allowances for adjustments to punctuation and word dividers.

/* Without Using Library function */
void main()
{
    char nm1[20],nm2[20];
    int i,j;
    printf("Enter your text>> ");
    gets(nm1);
       for(i=0;nm1[i]!='\0';i++);
    /* Assine first string in second in reverse order */
      for(i--,j=0;i>=0;i--,j++)
        nm2[j]=nm1[i];

    /* Checking whether both're same or not */
       for(i=0;nm1[i]!='\0';i++);
    for(j=0;nm1[j]==nm2[j] && nm1[j]!='\0';j++);
    if(j==i)
        printf("Palindrom");
    else
        printf("Not Palindrom");
}

/* Using Library String.h function
void main()
{
    char nm1[20],nm2[20];
    int i,j;
    printf("Enter your text>> ");
    gets(nm1);
    strcpy(nm2,nm1);
    strrev(nm2);
    if(strcmp(nm1,nm2)==0)
        printf("Palindrom");
    else
        printf("Not Palindrom");
  }

Multiplication of 2D Array (Matrix)

#include<stdio.h>
#define row 2
#define col 2
void main()
{
/* *********Multiplication Rule ***********
  First Arrar Column must be same as Second Array row
  otherwise multiplication can't take place
  By Girfa
*/
int a[row][col],b[row][col],cc[row][col],r,c,k,sum=0;
clrscr();
printf("\n*****Enter Data for first Array*****\n");
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
printf("Enter [%d][%d]'st number>>  ",r+1,c+1);
scanf("%d",&a[r][c]);
}
}
printf("\n*****Enter Data for Second Array*****\n");
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
printf("Enter [%d][%d]'st number>>  ",r+1,c+1);
scanf("%d",&b[r][c]);
}
}
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
cc[r][c]=0;
}
}
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{

  for(k=0;k<2;k++)
  {
sum=sum+a[r][k]*b[k][c];
  }
  cc[r][c]=sum;
  sum=0;
}
}
clrscr();
printf("\n***** first Array*****\n");
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
printf("\t%d",a[r][c]);
}
printf("\n");
}
printf("\n***** Second Array*****\n");
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
printf("\t%d",b[r][c]);
}
printf("\n");
}
printf("\n***** Result *****\n");
for(r=0;r<2;r++)
{
for(c=0;c<2;c++)
{
printf("\t%d",cc[r][c]);
}
printf("\n");
}
getch();

Tuesday 18 September 2012

How to connect word document to MS Access database

HI............
word is a software which is used to process word but you can save record in access.
Using word for doing this you will have to use control box from Toolbar.
After getting control box, Take control which you want...
I'm using 3 textbox and 1 button in my example




Now double click on your button . VB coding window will appeared.
For database connectivity I have use ADODB class.
you need to  add   a reference of  this class otherwise you can't use this.
for add reference in vb coding window click
Tools>references
Select Microsoft ActiveX Data Object 2.6 Library

Start and Stop Marquee using mouseover and mouseout event and News Ticker

Hi.... this is raj..........
Marquee is a HTML tag which is use to scroll an object over a page.
There are many direction (left,right,alternate). Where object moves.You can stop
and start a marquee using java script.Marquee object has methods start and stop.
Which are respectively used to start and stop a marquee.
Copy and paste following example save with .htm or .html extention...


<html>
<head>
<title>Girfa : Java Script Marquee Demo </title>
<script language="javascript">
function stopM()
{
var ob=document.getElementById('m1');
ob.stop();
}
function startM()
{
var ob=document.getElementById('m1');
ob.start();
}
</script>
</head>

<body>
<div style="height:210px;width:210px;border:outset 3px blue"">
<marquee onmouseover="stopM()" id="m1"
onmouseout="startM()" >
<a href="a.jpg"><img src="a.jpg" height=200px width="200px">
<a href="b.jpg"><img src="b.jpg" height=200px width="200px">
</marquee>
</div>
</body>
</html>


Monday 17 September 2012

How to stop multiline textbox resizing

Multi line textbox is a form control .where user can enter multiple line of text.
We can specify the size of textbox but user can change it run time using mouse
if you want to stop it paste following css in your text box HTML tag

style="resize: none;"


<textarea  rows="2" cols="20"

style="height:96px;width:185px;resize: none;"></textarea>

Create Keyboard Shortcuts to Insert Symbols in Word and Excel

Hi......
Office has many symbol which is not available in keyboard but we write them using symbol 
Let’s start with Word
, which is the easiest. In Word 2003, press InsertSymbol, which engages the Symbol screen (see screenshot below). In Word 2007, press Insert on the Ribbon and then click on SymbolMore Symbols.

Develop by Raj Kumar

Develop By Raj Kumar

Be careful when you are going to use a key click in shortcut textbox under circle press key which you which
you want to use. You can't type in shortcut key  text box click assine.

Excel

In Excel 2003, press Tools and select the AutoCorrect Options. In Excel 2007, click the Office button and Excel Options. Then click on Proofing on the left of the dialog box and click on AutoCorrect Options.

Develop by Raj Kumar





Handle more than one button event in java

In computer science an event is an action that is usually initiated outside the scope of a program and that is handled by a piece of code inside the program. GUI based programming is based on event, if you want handle event of a button in java (Applet,Swing) then you have to use ActionListener interface and implements actionPerformed funtion.We use more than one button in java program for handle each button event individually for achieve this we mustidentified each button event uniquely. You can identified button by its name or its text value, text value is not good becouse there can be same text on more than one button. Getting Button name is more usefull conside following program.....
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class ButtonEventDemo extends Applet implements ActionListener
{  
       Button bt1,bt2,bt3;   Label lbl;  
       public void init() 
       {     
            bt1=new Button("Button1");   
            bt2=new Button("Button2");
            bt3=new Button("Button3");     
           lbl=new Label("Label");    
           Add(bt1);        Add(bt2);      
           Add(bt3);        Add(lbl);      
           bt1.addActionListener(this);     
           bt2.addActionListener(this);        
           bt3.addActionListener(this);  
      } 
      public void actionPerformed(ActionEvent e)
      {     
           // String s=e.getActionCommand();       
          // if(s=="Button1")     
          //  {      
         //             lbl.setText("Clicked Button 1");   
         //   }       
         //   else     
         //   {      
         //             lbl.setText("Clicked Button 2");     
        //    }         
             Object ob=e.getsource();           
             if(ob.equals(bt1)                
                 lbl.setText("Clicked Button 1");      
             else          
             {                
                   if(ob.equals(bt2)                   
                      lbl.setText("Clicked Button 2");                 
                  else                       
                       lbl.setText("Clicked Button 3");           
              }
         }

                  
String s=e.getActionCommand();
this command will set text of control which create control in s e.g.  if button clicked then s will hold Button1 textso we can check control text to uniquely identified a control but its not so good because there can be same text of more than one control.                 
                Object ob=e.getsource();
this line initialize ob with Button reference which name is bt1 if bt1 is clicked otherwise other control instanceso it is useful  to uniquely identified button because button name always unique in a program . 

Saturday 15 September 2012

Make your own list in excel 2003 and 2007

Excel has a powerful feature which enable user to input by using drag operation we have use this when we want to write month name we'll just have to write jan or January and drag it excel will automatically fill all remaining month name.
You can make your own custom list which help you to input in a fast way....


Excel 2003     

  • Type your list as in the image
  • Goto tools >Optoins>CustomLists>Select your list range>import

Excel 2007     

  • Type your list as in the image
  • Office Button > Excel Options > Popular > Edit Custom List.. > Select your list range > import

Friday 14 September 2012

How to create mirrored text in PowerPoint, in Word, and in Excel


A mirror image is a reflected duplication of an object that appears identical but reversed. As an optical effect it results from reflection
To create mirrored text with WordArt, follow these steps:
On the Drawing toolbar, click Insert WordArt.
Enter your Text which you want to make Rotate and make its Copy as in image...





  •  Now click on Upper In charge word art
  •  Click format
  • Then click rotate and select Flip Vertical

Friday 31 August 2012

Don't Do it

This program will act as virus because it stop your computer working until you  restart your computer.This is power of DOS batch file
  1. start
  2. start.bat
Save this file with start.bat name and run...
and give me your feedback I'm waiting

Tuesday 28 August 2012

Java Package


Hi there......
Java provides a mechanism for partitioning the class name space into more manageable chunks. This mechanism is the package. The package is both a naming and a visibility control mechanism. You can define classes inside a package that are not accessible by code outside that package.
To create a package is quite easy: simply include a package command as the first
statement in a Java source file. Any classes declared within that file will belong to the
specified package. The package statement defines a name space in which classes are
stored. If you omit the package statement, the class names are put into the default
package, which has no name.
  • Package name must be saved in same name folder
  • One package can comprise more than one class
  • Java source code and class should be saved in same folder as package name
  • One Java source file can include only one public class
  • For make more than one class in same package every java source file must be saved in separate file
  •  Java source file class should be public visibility otherwise class'll not be available for outside of package
package demo;
public class Myclass
{
        public void show()
        {
              System.out.println("Package function");
        }

when you will compile this file then it will create a class file named Myclass  you  must save this file in demo  named folder.Ones everything gos ok then you are ready to use this file.. consider following code where i am using this...
import demo.Myclass ;
//import demo.*;   for import all class in demo package
class MainFile
{
      public static void main(String args[])
      {
             Myclass ob=new Myclass();
             ob.show();
       }
}

A package can be nested like java.awt.event as i discussed above that every package should be save in same name folder so you will have to a folder in your current folder named as you want for package

package demo.demo2;
public class Myclass
{
       public void show()
       {
             System.out.println("Function from demo 2 package");
        }
}

You must make a folder named demo2 in demo folder.You can make more nested package as you want you just have make a folder.When user will use such package they'll have to provide all heir achy of package in this case it will be
import demo.demo2.*;
class packdemo
{
    public void show()
    {
         System.out.println("Nested package function");
     }
}
  • When you save this package in Bin folder then you can use (javac) for compile
  • If your package folder is outside of bin folder then you can use ( javac -classpath <java sourcefile>)
  • -classspath will search your package class file

Thursday 23 August 2012

Make a numeric Text Box In VB.net and C#

hi...........
Most of the time we want to a text box which can only take numeric value such as textbox design for taking input of age and we know age must be a number.Textbox is a control which takes string values by default for change its functionality follow instruction....
Key events occur in the following order:
  1. KeyDown
  2. KeyPress
  3. KeyUp
To handle keyboard events only at the form level and not enable other controls to receive keyboard events, set the KeyPressEventArgs..::.Handled property in your form's KeyPress event-handling method to true. Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. To have these keys raise the KeyDown event, you must override the IsInputKey method in each control on your form. The code for the override of the IsInputKey would need to determine if one of the special keys is pressed and return a value of true.

VB.Net


Wednesday 1 August 2012

How to Show Power Point Slide Show in Visual Basic

There are many way to show a power point slide show in vb form one can use OLE or a frame window
I'm showing it in a separate window. to show presentation do following steps

Make some declaration in general section 

  • Public oPPTApp As Object          
  • Public oPPTPres As Object
  • Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
          (ByVal lpClassName As String, _
           ByVal lpWindowName As Long) As Long
  • Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Function for show presentation

Private Sub slideShow() 
    Dim screenClasshWnd As Long
    Set oPPTApp = CreateObject("PowerPoint.Application")
    If Not oPPTApp Is Nothing Then
            Set oPPTPres = oPPTApp.Presentations.Open("Paste Your Presentation file path", , , False)
         If Not oPPTPres Is Nothing Then
             With oPPTPres                  
                          With .SlideShowSettings
                                 .ShowType = 1000
                                 .Run
                        End With
                Call SetWindowText(FindWindow("screenClass", 0&), APP_NAME)
        
        End With
       Else
        MsgBox "Error : Could not open the presentation.", vbCritical, APP_NAME
    End If
Else
    MsgBox "Could not instantiate PowerPoint.", vbCritical, APP_NAME
End If
End Sub

 

     

Monday 30 July 2012

How to get input in character type array in java

Hi ............
There are many way to get input in java. Java works on two type of stream 1. Character Stream 2. Byte Stream
Java treats Char data type different form c and c++. In C/C++ char data type hold 7 bit ASCII Character which is 0 to 127 characters but java char data type works on Unicode.
  • System.in.read() takes one character from user and return correspondence int value
  • for hold it we have to type cast in char
  • System.in.read() stop when user press enter its take it '\n'
class CharInput
{
           public static void main(String args[]) throws Exception
           {
                  char ar[]=new char[5];
                  int i;
                  for(i=0;i<ar.length;i++)
                  {
                          ar[i]=getChar();
                   }
            }
            static char getChar() throws Exception
            {
                   char ch=(char) System.in.read();
                   pressEnter();
                   return ch;
             }
             static void pressEnter() throws Exception
             {
                    while((char) System.in.read()!='\n');
              }
}  
  • As we know System.in.read() stop input when it encounter newline
  • i have make getChar function which is taking input from user and sure newline using pressEnter function
  • pressEnter is use to ensure newline character using while loop
  • loop stop when user press enter otherwise it looking in stream for new line

Wednesday 4 July 2012

Add Controls Run time in VB.NET & C#


hi............
Mostly we make control design time, we handle many event like click, mouseover,moueout etc. This is a easy process for design time because there is not any need to attach event handler visual studio attach necessary code automatically.
You can add control on run time………… for do this you will have to perform following steps
  • Make an object of relevant control
    eg. Button btn =new Button()      [C# ]
          dim btn as new Button()         [VB.NET]
  • After make an object of control you have to manage control property
    eg. Location,size,backcolor,text etc
  • You can also attach events..
Add an Button in C#
  Button btn = new Button();
            btn.Text="Click";
            btn.Location=new Point(100,100);
            btn.Click +=new EventHandler(btn_Click);
            this.Controls.Add(btn);
     following function will catch and handle button click event….
private void btn_Click(object sender,EventArgs e)
        {
            MessageBox.Show("Called");
        }
Add a combo box in vb.net
            Dim com As ComboBox
        com = New ComboBox
        com.Items.Add("one")
        com.Items.Add("two")
        com.Items.Add("three")
        com.Location = New Point(150, 100)
        AddHandler com.SelectedIndexChanged,AddressOf com_click
        Me.Controls.Add(com)
following function will catch and handle combo box
selectindexchange event….
       Private Sub com_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        MsgBox("Called event")
    End Sub
       

Monday 2 July 2012

How to Retrieve records from ms access using date field in condition

Hi...... there
As you know SQL is a language which enable us to use database. If you've knowledge of SQL then you can operate any database software, for achieve this you just need to know how to run SQL Statement in that DBMS package
One thing you must know that there are some different in SQL in different DBMS package they use different data type and size, they treat date field as different way so if you want to use SQL you must know what are the SQL specification for that DBMS package
Develop Raj Kumar
Form of project
  • MS Access treat date field differently from SQL server
  • If you want to make a condition based on date you'll have to put date between ## e.g #7/28/2010
  • Import System.Data.OleDb name space for oledb class

     

     

     

    Save Button Code

    Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=your path")
            Try
                con.Open()
                Dim dd As String
                dd = DateTimePicker1.Value.Date
                Dim com As New OleDbCommand()
                com.Connection = con
                com.CommandText = "insert into stu values(" & TextBox1.Text & ",'" & TextBox2.Text & "','" & dd & "')"
                com.ExecuteNonQuery()
                MsgBox("Saved")
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try

    Search Button Code

     Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Your Path")
            Dim da As New OleDbDataAdapter("select * from stu where dob=#" & DateTimePicker1.Value.Date & "#", con)
            Dim ds As New DataSet
            da.Fill(ds)
            DataGridView1.DataSource = ds.Tables(0)

Friday 8 June 2012

How to save a file from HTML File Control in AJAX Section Using ASP.Net with C#



    •     AJAX stands for Asynchronous  Java script and XML  
    •    AJAX enable a page asynchronously post back a page.  
    •   Only required part load from server instead of entire page so its   increase web performance.
    • Some control which are design for post back like file browser which can’t load a file if its not post back so you can’t upload a file when it’s in AJAX section.

        For upload a file in AJAX section using file browser you need to register a button for post back if user will click on than button then all page will be reloaded.
      <asp:UpdatePanel ID="U1" runat="server">
                <ContentTemplate>
      ....................................
      ....................................
               </ContentTemplate>
         <Triggers> 
             <asp:PostBackTrigger ControlID="saveButton">
         </Triggers>  
      </asp:UpdatePanel> 
      Here is your html code i leave ...... for your content Savebutton is a which post back entire page
      So i registered this button in trigger section post backTrigger register control which have to post back.....

Wednesday 6 June 2012

Create Album Using Java Script with fade effect



Hi.................
This post will help you to make a picture album.Pictures of album will change during a second internal.
I have done this with the help of java script.
  • This post will create a static album in nature you can't add a new image at run time if you want to add or remove image you will have to change java script code.
  • Save your picture in a folder and rename all picture into 1 to increasing order e.g (1.jpg , 2. jpg ,3,jpg...)
  • Count no. of picture in your folder because I'll use this number in java script code block
  • I used a timer which will run continue you can not stop it

Image Slide Show Using HTML

This is a presentation of a image slide show.This blog will help
you to make a moveable slide show right to left
This is a flat HTML coding.
This is achieve by marquee tag.Marquee tag has capacity to move any type of object inside it.I used marquee for make this slide show.


       

  • I saved my HTML file and all image in a folder so used relative path
  • if your image isn't in current folder then you need to provide full path of that image.....
   






Monday 4 June 2012

Save and Retrieve an image in Ms Access Using VB.Net

Hi.......
Its very simple to save and retrieve image in ms access for performing save retrieve you need to do something as mention...........
  • Aceess store image in binary format
  • We've to convert an image into binary at save time and binary ti bitmap at retrieve time

Database Table Structure 

 

 

 

 

 

 

 

 

 

  


Saturday 2 June 2012

Retrieve an Image from SQL Server in Picture Box Using VB.Net

Hi, There
Retrieving an image from sql server database is so simple just do following steps
  • Make a project and database which i mention in my Blog Take a look 
  • Add a picture box on your form, and a button for show image
  • On Show Button Click event paste following code

Friday 1 June 2012

Save an Image in SQL Server Database With VB.Net

Hi
Saving Image is an important part of any software,They're many ways to handling image.One easy and secure way is save your image in sql server database.If you want to save image in sql server then follow these steps
  • Make a database and a table with following description my database name is bsw and table name is stu
Database Table Structure

VB Project Controls Which you have to use
  •  You have to import 2 name space
    Imports System.IO
    Imports System.Data.SqlClient
  • Add OpenFileDialog control
  • And make a global string variable named str
    • On Browse picture button click paste following code
        OpenFileDialog1.ShowDialog()
         str = OpenFileDialog1.FileName
On Click event of save button paste following code


Dim con As New SqlConnection("initial catalog=bsw;data source=.;integrated security=true") Dim com As New SqlCommand()
Try
            Dim fs As New        FileStream(str,FileMode.Open)
            Dim data() As Byte = New [Byte](fs.Length) {}
            fs.Read(data, 0, fs.Length)
            fs.Close()
            'readed image
            Dim roll As New SqlParameter("roll", SqlDbType.Int)
            roll.Value = Val(TextBox1.Text)

            Dim name As New SqlParameter("name", SqlDbType.Char, 10)
            name.Value = TextBox2.Text

            Dim city As New SqlParameter("city", SqlDbType.Char, 10)
            city.Value = TextBox3.Text

            Dim img As New SqlParameter("img", SqlDbType.Image)
            img.Value = data
            'Adding parameters
            com.Parameters.Add(roll)
            com.Parameters.Add(name)
            com.Parameters.Add(city)
            com.Parameters.Add(img)
            con.Open()
            com.Connection = con
            com.CommandText = "insert into stu values(@roll,@name,@city,@img)"
            com.ExecuteNonQuery()
            MsgBox("Saved")
            Me.StuTableAdapter.Fill(Me.BswDataSet1.stu)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try