actually i want to update the leave details for the particular employee,after updation i have a check control button if i click the button it will check the database and display the total leave for the particular employee..but in the table i dont mension any total column,just i am using sql query..how to display the total sl leave,pl leave ,cl leave in the textbox.this is my table columns
empcode empname compname,leavetype,fdate,tdate,reason,cl,sl,pl
this is my query
select empcode,SUM(sl) TotalSL,SUM(cl) TotalCL,SUM(pl) TotalPL from leave where empcode = '" + DropDownList2.Text + "'group by empcode
this is my code
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
connection.ConnectionString = ("Data Source=RIFAYEE-PC;Initial Catalog=test;Integrated Security=True")
cmd = New SqlCommand("select empcode,SUM(sl) TotalSL,SUM(cl) TotalCL,SUM(pl) TotalPL from leavedepot where empcode = '" + DropDownList2.Text + "'group by empcode", connection)
Dim reader As SqlDataReader
connection.Open()
reader = cmd.ExecuteReader
If reader.Read = True Then
TextBox8.Text = reader(9).ToString
TextBox11.Text = reader(8).ToString
TextBox12.Text = reader(10).ToString
Else
Response.Write("No Data In The Database")
End If
End Sub