Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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 January 25th, 2008, 11:04 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default How to debug a BindDataGrid( ) for a GridView

We have an ASPnet 1.1/1.0 project, coding a Sub BindDataGrid( ) for a GridView control.
Here we declared a SQL statement to fill a dataset. The query string contained a WHERE statemet
to display the GridView when the ApptsTime >= strApptPreTime.

(A.ApptsDate > '" & strApptPreDate & "' OR (A.ApptsDate = '" & strApptPreDate & "' AND A.ApptsTime >= '" & strApptPreTime & "' ))" & _

Somehow, we can display GridView only after 10 am, even the 8/9 am data have been created and shown in the SQL Server database.
Tried to debug the Sub BindDataGrid( ), but can set up breakpoints only. After started debugging to create Watch, Auto, or Local windows,
 the 'step in' is deactivated and variavles can not be moved to Watch/Auto/Local windows.

Wondering how to debug a query string in a Sub BindDataGrid( )?


TIA,
Jeffrey
__________________
C. Jeffrey Wang
 
Old January 25th, 2008, 12:40 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

It works very well now. However, I can see the values for strApptPreDate, strApptPreTime, etc but not the A.ApptsTime. On the Watch 1 window, the Value column displayed:
 ' A.ApptsTime' is not declared or the module containg it is not loaded.'

The Locals window showed all kind of data, e.g. dApptCalcNewDate= #1/25/2008 10:05:09 AM#; and strApptPreTime="10:05". Again,
I just can not see the values for ApptsTime. Tried Immediate windows, typing ? A.ApptsTime, showed the same error as Watch 1 window.

How can I view the A.ApptsTime from the SQL Server database?

Thanks,
Jeffrey
 
Old January 25th, 2008, 01:30 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can't debug SQL server data directly from visual studio the way you are trying to. There are ways to debug stored procedures but I haven't done it. Furthermore, you're trying to look at a column value. There are many rows in the table so aren't going to be able to see (if it were possible) the value of the row being evaluated by the sql query.

You stated "The query string contained a WHERE statemet". It is very highly advised NOT to do this. This technique is basically asking for trouble. It is very easy to perform SQL injection attacks and trash your database or expose data you don't want exposed. You should really use SQL command objects with parameters. This greatly reduces the risk.

-Peter
 
Old January 25th, 2008, 02:31 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is there any way I can debug or trace when or how the
BindDataGrid( ) runs before 9 am? Why BindDataGrid or GridView
does not run when AppsTime > strAppsPreTime?

Jeffrey
 
Old January 25th, 2008, 03:28 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Perhaps it's just me, but this discussion is confusing me.

Are you having problems the software at a specific time of day?
Is the problem related to date/time data you are expecting to get back but aren't?

Please provide more detail. A summary of what you are trying to achieve would be helpful. Also some code? But PLEASE only post the relevant code. I.e. post your BindDataGrid() method (trim out what isn't relevant to this question if necessary). Please also post other code that is directly relevant to the behavior of BindDataGrid().

-Peter
 
Old January 25th, 2008, 05:25 PM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 124
Thanks: 0
Thanked 1 Time in 1 Post
Default

Okay, here is a half-time summary.

1. Problem Statement
   Before 9 am, I can see the new, 9 am data in SQL Server database table, but no GridView presentation. At 9:06 am, I can see the old 9 am and the new 10 am data in SQL Server database table, but only 10 am data on the GridView Statement. The 9 am data were skipped. After 10 am, the GridView works just fine for the new data.

2. Debugging query string of the BindDataGrid( ) for the GridView
   To find out why no BindDatGrid( ) for 9 am data, I debugged the query string. On Watch/Local/Immediate windows, I can see the values from Server time, but not the query time data from the SQL Server database. Therefore, I still have no answer why no BindDataGrid( ) before 9 am.

3. BindDataGrid( ) 9 am data is my original question, while debugging the SQL Server query string is the new question.

Thanks,
Jeffrey





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Help Debug arholly Access VBA 19 December 18th, 2006 01:52 PM
Debug com component vinaykumar_inavolu C# 2005 0 October 12th, 2006 07:15 AM
Can't debug sithlrd General .NET 9 July 28th, 2004 05:00 PM
Can't Debug shmacgregor General .NET 6 March 1st, 2004 05:10 PM





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