Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2004, 08:08 PM
Registered User
 
Join Date: Oct 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default request querystring

hi all,

im trying to use a request.querystring to link my page. whereby when the user click on the calendar, it will link to the exact date and event for the day. but it does not seem to be working. hope anyone can help me in this. thanks!


Private Sub eventDate_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles eventDate.SelectionChanged
        Dim sql, dbcomm
        Dim dbcon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\fyr project\bin\DESIGNATION.mdb;")
        sql = "SELECT * FROM EVENT"
        dbcomm = New OleDbCommand(sql, dbcon)
        Dim dr As OleDbDataReader

        dbcon.Open()
        dr = dbcomm.executeReader()

        Do While dr.Read
            Response.Redirect("displayCalendarEvent.aspx?query =" & eventDate.SelectedDate & "")
        Loop
    End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        DataGrid1.CurrentPageIndex = 0

        Session("date") = Request.QueryString("query")
        Label1.Text = Session("date")

        Dim sql, dbcomm, dbread
        Dim dbcon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\fyr project\bin\DESIGNATION.mdb;")

        dbcon.Open()
        sql = "SELECT * FROM EVENT WHERE event_date = '" & Session("date") & "'"
        dbcomm = New OleDbCommand(sql, dbcon)

        Dim ds As New DataSet
        Dim adapter As New OleDbDataAdapter
        adapter.SelectCommand = dbcomm
        adapter.Fill(ds)

        DataGrid1.DataSource = ds
        DataGrid1.DataBind()

    End Sub

 
Old October 25th, 2004, 10:35 AM
Authorized User
 
Join Date: Oct 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1 eventDate_SelectionChanged
  why do you open a DataReader? - you do not use it!
  why do you make a loop? - i understand you are going to change from a place to another using a value from calendar!

2 Page_Load
   why are you not using Ispostback? - you are not keeping 'states'!

advice: try to debug your code. if you are using vs, it has one; if you are using another program(webmatrix), use dbgclr. step-by-step you can see what's wrong with your code!

wagner reatto

Intel P4 2.8 Ghz | 1 Gb RAM | 120 Gb HD | NVidia | Soundblaster

Windows 2000 Pro | ADSL

Mozilla Firefox





Similar Threads
Thread Thread Starter Forum Replies Last Post
Request.Form / Request.QueryString Toran Classic ASP Databases 4 January 17th, 2007 02:23 PM
Request.Querystring ms_code_bsuter ASP.NET 1.0 and 1.1 Basics 1 February 10th, 2006 08:10 PM
Problem with Request.QueryString mg1966 Classic ASP Databases 4 January 7th, 2005 02:04 PM
Request.QueryString problems gmoney060 Classic ASP Databases 3 July 23rd, 2004 10:34 AM
request.querystring() , request.form() alyeng2000 ASP.NET 1.0 and 1.1 Basics 1 December 30th, 2003 12:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.