Wednesday, April 27, 2011

Prectical Prectise Questions

Q1] Create a database for vehicle service job contains job-master(job-no, vehicle-no, attend(y/n), type of job (accident, service, color), job-description, entrydate, deliverydate). Write a vb.net code which provide facility of DML, navigation and search operation. Provide search facility on vehicle-no and jobtype jointly, Display result in datagridview.


Q2] Create a webpage which display information about a medical shop. The registered user can order medicine online. Provide appropriate constraints to accept user's personal information using form. Also provide facility to order for medicines which provide facility to order multiple medicines and calculate total Bill-amount.


Q3]
a) Write a java code which accept names and age of 10 students. Sort the names of students agewise in ascending order. Display the names of students using thread class at interval of one seconds.
b) Write a java application which display a pentagon containing a circle within the pentagon where the circumference of the circle touches to the edges of the pentagon. Provide separate colors to both the objects. Display your name in center position of the circle.

Tuesday, April 26, 2011

Solution of Report Daywise Weekwise & Itemwise

Imports System.Data.OleDb
Imports System.Data
Public Class Form1
    Dim cn As OleDbConnection
    Dim da As OleDbDataAdapter
    Dim ds As DataSet
   
'Daywise Report
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Report1.mdb;Persist Security Info=True")
        da = New OleDbDataAdapter("SELECT BillDate AS [BillDate By Day], Sum(Rest.TotalBill) AS [Sum Of TotalBill] FROM Rest GROUP BY BillDate", cn)
        ds = New DataSet
        da.Fill(ds)
        DataGridView1.DataSource = ds.Tables(0)
    End Sub

'Weekwise Report
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'To Find Week      
        Dim sdate As Date = New Date(Today.Year, Today.Month, 1)
        Dim edate As Date = sdate.AddDays(6)
        While (edate.Month = Today.Month)
            cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Report1.mdb;Persist Security Info=True")
            da = New OleDbDataAdapter("SELECT Sum(TotalBill) FROM Rest Group by BillDate Having BillDate >= #" & sdate & "# and BillDate <= #" & edate & "#", cn)
            ds = New DataSet
            da.Fill(ds)
            DataGridView1.Columns.Add("Week", "Week")
            DataGridView1.Columns.Add("Total", "Total Collection")
            If ds.Tables(0).Rows.Count > 0 Then
'Dynamically add rows to gridview               
   DataGridView1.Rows.Add()
   DataGridView1.Rows(i).Cells(0).Value = sdate.ToString & "-" &  edate.ToString
   DataGridView1.Rows(i).Cells(1).Value = ds.Tables(0).Rows   (i).Item(1).ToString
End If
'Find Next Week           
            sdate = sdate.AddDays(7)
            edate = sdate.AddDays(6)
        End While
       
    End Sub

'Itemwise Report
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Report1.mdb;Persist Security Info=True")
        da = New OleDbDataAdapter("SELECT Itemname , Sum(Rest.TotalBill) AS [Sum Of TotalBill] FROM Rest GROUP BY Itemname", cn)
        ds = New DataSet
        da.Fill(ds)
        DataGridView1.DataSource = ds.Tables(0)
    End Sub
End Class