473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

debugging dataset

..NET 2.0

I'm having trouble with a DataTable in my dataset. this code don't return
any rows:
data.database.datatable1.Select("username = '" + sName + "''");

The output should have been 4 rows, but I get 0 rows

I think this may be caused by a bad select (I'm a newbie to using dataset, I
prefer stored procedures.)

Is there a way I can see the select this code generate during runtime? , I
mean the entire select with the where clause generated in the
Select("username = '" + sName + "''");.... Then I could try that select in
Sql Server Management Express and hopefully solve the problem...

any suggestions?

Jeff


Jul 18 '07 #1
2 1433
.NET 2.0
>
I'm having trouble with a DataTable in my dataset. this code don't
return
any rows:
data.database.datatable1.Select("username = '" + sName + "''");
The output should have been 4 rows, but I get 0 rows

I think this may be caused by a bad select (I'm a newbie to using
dataset, I prefer stored procedures.)

Is there a way I can see the select this code generate during runtime?
, I mean the entire select with the where clause generated in the
Select("username = '" + sName + "''");.... Then I could try that
select in Sql Server Management Express and hopefully solve the
problem...

any suggestions?

Jeff
What exactly is in your variable sName, and what exactly is in the field
username? Any spaces that throw the select off? Different casing (upper/lower)?

This Select() method does not generate a select query on the database,
instead it is a "sql-like" query on the dataset (datatable) itself. So there
is no "entire select" for you to inspect.

First build that query in a separate string variable, so you can inspect
that to see if there are any problems (unexpected spaces, embedded quotes).
Then use that variable in the Select() - no need to build the query twice.

Inspect the datatable: are the rows you want really there? The values
in the username column, are they what you expect?

If you select on other fields and/or values, do you get the expected rows
back?
(I think you can execute those queries in the QuickWatch window)

Hans Kesting
Jul 18 '07 #2
Thanks, I've just manage to solve this problem...
"Hans Kesting" <ne***********@spamgourmet.comwrote in message
news:c0**************************@news.microsoft.c om...
>.NET 2.0

I'm having trouble with a DataTable in my dataset. this code don't
return
any rows:
data.database.datatable1.Select("username = '" + sName + "''");
The output should have been 4 rows, but I get 0 rows

I think this may be caused by a bad select (I'm a newbie to using
dataset, I prefer stored procedures.)

Is there a way I can see the select this code generate during runtime?
, I mean the entire select with the where clause generated in the
Select("username = '" + sName + "''");.... Then I could try that
select in Sql Server Management Express and hopefully solve the
problem...

any suggestions?

Jeff

What exactly is in your variable sName, and what exactly is in the field
username? Any spaces that throw the select off? Different casing
(upper/lower)?

This Select() method does not generate a select query on the database,
instead it is a "sql-like" query on the dataset (datatable) itself. So
there
is no "entire select" for you to inspect.

First build that query in a separate string variable, so you can inspect
that to see if there are any problems (unexpected spaces, embedded
quotes).
Then use that variable in the Select() - no need to build the query twice.

Inspect the datatable: are the rows you want really there? The values
in the username column, are they what you expect?

If you select on other fields and/or values, do you get the expected rows
back?
(I think you can execute those queries in the QuickWatch window)

Hans Kesting


Jul 18 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: pantichd | last post by:
<I also posted this on microsoft.public.vsnet.debugging 'cuz I didn't know which was more appropriate or would get quickest response> Hello, Can someone tell me how I can view the contents...
1
by: Michael.EJ.Reynolds | last post by:
Is there any better way to debug a query encased in IIF statements than to find bugs at runtime? I have an especially ugly CommandText for one of my datasets, and debugging it when there is an...
0
by: n_o_s_p_a__m | last post by:
Ok, while debugging, when I use f10 or f11 to step in, the debugger stops working. It just hangs indefinitely, no matter which line I f10 or f11 on (as below). This is a BIG PROBLEM, and it is...
10
by: CD | last post by:
Hi, I'm very new to C# and am working on using a stored procedure to MSSQL with two date parameters. The first problem I'm having is that SQL appears to be throwing an exception (or my parameters...
8
by: Matt Theule | last post by:
While stepping through an ASP.NET project, I found that data was being inserted into my database even though I was not stepping through the code that inserted the data. I have a single page with...
1
by: Welman Jordan | last post by:
When I debug an asp.net application, which would consume a considerable amount of memory, the application throws "unhandled exception" and delivers a 500 error page to the browser. I find that...
7
by: rodchar | last post by:
Hey all, when i'm in debug mode, is there a way to get to a certain record in a dataset (say like in the Immediate window or something)? thanks, rodchar
0
by: Jon Vaughan | last post by:
Hey all, First post, so i'm hope im in the right place : Basically I have a web service and an interface as the consumer in two seperate projects running on the same machine. There is a single...
5
by: DCC-700 | last post by:
I am using ASP.Net with VB on the 1.1 Framework running on Win XP Pro. I am trying to gauge the time it takes to sort a datagrid using different code sets. But when I am debugging the page there...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.