Please help values disappear before getting them to my strings declaration
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WebForms
Public Class Finance
Inherits System.Web.UI.Page
Dim con As String = ConfigurationManager.ConnectionStrings("INTERVIEWSConnectionString").ConnectionString
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim currentd As System.DateTime = System.DateTime.Now
Fromd.Text = currentd.Date.ToString("dd/MM/yyyy")
Dim currentdt As System.DateTime = System.DateTime.Now
Tosd.Text = currentdt.Date.ToString("dd/MM/yyyy")
End Sub
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim named As String = DropDownList2.SelectedValue
Dim fina As String = "Finance"
Dim ffees As String = Formfee.Text
Dim intake As String = DropDownList1.SelectedValue
'Dim point As Boolean = CheckBox2.Checked
Dim sqlConnection12 As New SqlConnection(con)
Dim objCommand22 As SqlCommand = New SqlCommand()
Dim cmd2 As New SqlCommand
cmd2.CommandText = "summary2022"
cmd2.CommandType = CommandType.StoredProcedure
cmd2.Connection = sqlConnection12
cmd2.Parameters.Add("@it", SqlDbType.NVarChar, 50).Value = DropDownList1.SelectedValue
sqlConnection12.Open()
cmd2.ExecuteReader()
sqlConnection12.Close()
Response.Redirect(String.Format("~/Reports/DisplayReport.aspx?class={0}&intake={1}&CategoryReport={2}&Formfee={3}", named, intake, fina, ffees))
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim cmd As New SqlCommand("SELECT Account,upper(Name) as Name,Class,Stream,Category,Intake,Eng,Maths,Sst,Science, ([maths]+[eng])/2 AS Average,([maths]+[eng])AS TotalMarks
FROM student
WHERE (((student.Class)=@c) AND ((student.Intake)=@it)) and (status IS NULL)
ORDER BY class,student.Name, [maths]+[eng]/2 DESC;")
cmd.Parameters.AddWithValue("@c", DropDownList2.SelectedItem.Text)
cmd.Parameters.AddWithValue("@it", DropDownList1.SelectedItem.Text)
Label2.Text = Nothing
Studentgrid.DataSource = Me.ExecuteQuery(cmd, "SELECT")
Studentgrid.DataBind()
'Required for jQuery DataTables to work.
Studentgrid.UseAccessibleHeader = True
If Studentgrid.Rows.Count = 0 Then
Response.Write("<script>alert('No Records yet for this Class');</script>")
Exit Sub
Else
Studentgrid.HeaderRow.TableSection = TableRowSection.TableHeader
End If
End Sub
Private Function ExecuteQuery(ByVal cmd As SqlCommand, ByVal action As String) As DataTable
'Dim conString As String = conString
Using cont As New SqlConnection(con)
cmd.Connection = cont
Select Case action
Case "SELECT"
Using sda As New SqlDataAdapter()
sda.SelectCommand = cmd
Using dt As New DataTable()
sda.Fill(dt)
Return dt
End Using
End Using
Case "UPDATE"
cont.Open()
cmd.ExecuteReader()
cont.Close()
Exit Select
End Select
Return Nothing
End Using
End Function
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If Fromd.Text = "" Or Fromd.Text = "__/__/____" Then
Dim time23 As String = "You Should Enter Date Range Please"
Dim script23 As String = "window.onload = function() { askConfirm('" & time23 & "'); };"
ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script23, True)
'Wizard1.ActiveStepIndex = 0
Fromd.Focus()
Exit Sub
End If
If Tosd.Text = "" Or Tosd.Text = "dd/mm/yyyy" Then
Dim time23 As String = "You Should Enter Date Range Please"
Dim script23 As String = "window.onload = function() { askConfirm('" & time23 & "'); };"
ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script23, True)
'Wizard1.ActiveStepIndex = 0
Tosd.Focus()
Exit Sub
End If
Dim named As String = DropDownList2.SelectedValue
Dim fina As String = "Print Estimate"
Dim ffees As String = Formfee.Text
Dim froms As String = Fromd.Text
Dim tosm As String = Tosd.Text
Dim intake As String = DropDownList1.SelectedValue
'Dim point As String = ""
' Dim point As Boolean = CheckBox2.Checked
Response.Redirect(String.Format("~/Reports/DisplayReport.aspx?class={0}&intake={1}&CategoryReport={2}&Formfee={3}&from={4}&Tosd={5}", named, intake, fina, ffees, froms, tosm))
'Server.TransferRequest(Request.Url.AbsolutePath, False)
End Sub
Protected Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Dim named As String = DropDownList2.SelectedValue
Dim fina As String = "Print Summary"
Dim ffees As String = Formfee.Text
Dim froms As String = Fromd.Text
Dim tosm As String = Tosd.Text
Dim intake As String = DropDownList1.SelectedValue
'Dim point As String = ""
' Dim point As Boolean = CheckBox2.Checked
Response.Redirect(String.Format("~/Reports/DisplayReport.aspx?class={0}&intake={1}&CategoryReport={2}&Formfee={3}&from={4}&Tosd={5}", named, intake, fina, ffees, froms, tosm))
'Server.TransferRequest(Request.Url.AbsolutePath, False)
End Sub
End Class
here iam supposed to enter dates but on clicking the button the values disappear
Protected Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Dim named As String = DropDownList2.SelectedValue
Dim fina As String = "Print Summary"
Dim ffees As String = Formfee.Text
Dim froms As String = Fromd.Text
Dim tosm As String = Tosd.Text
Dim intake As String = DropDownList1.SelectedValue
'Dim point As String = ""
' Dim point As Boolean = CheckBox2.Checked
Response.Redirect(String.Format("~/Reports/DisplayReport.aspx?class={0}&intake={1}&CategoryReport={2}&Formfee={3}&from={4}&Tosd={5}", named, intake, fina, ffees, froms, tosm))
'Server.TransferRequest(Request.Url.AbsolutePath, False)
End Sub