Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 11th, 2007, 06:18 PM
Registered User
 
Join Date: Jan 2007
Location: , New South Wales, Australia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Query Returning Dodgy Result

Howdy all, I must be going for a record, 2 posts in 2 days, hopefully this trend doesn't continue....

The short and thick of it. I have a query called 'FindNextCall' that is simply used to find the first row in my table that is blank. The table is called 'Prospect_CallDetails' and the query goes something like:
Code:
SELECT ID 
FROM Prospect_CallDetails
WHERE (No_Answer = 0) AND (Fax_Machine = 0) AND (Not_Interested = 0) AND (Engaged = 0) AND (CallBack = 0) AND (Disconnected = 0) AND (Wrong_Number = 0) AND (Answering_Machine = 0) AND (Suspend = 0) AND (Completed = 0) AND (No_Prospects_Paid = 0) AND (No_Prospects_Unpaid = 0) AND (Allocated_Tickets = 0) AND (Paid_Tickets = 0) AND (CallAttempt = 0)
Now, when I preview the data that the query returns using the 'Preview Data' option in the DataSet1.xsd tab, I get the right result, but when I try using the query I get a totally different result. I want to populate a textbox (called IDTextBox) on a form as I have other fields that have a dependency on the value of the IDTextBox. The way I am trying to populate the textbox with the query result is a follows: (The below snippet lives in the Form1_Load Procedure)
Code:
Me.IDTextBox.Text = Me.Prospect_CallDetailsTableAdapter.FindNextCall(Me.DataSet1.Prospect_CallDetails)
When I execute the project, it's returning a value to the textbox that is completely wrong. Is there a bug or something that I've done wrong? When I set a watch to see what value is being assigned, it's returning a value of say 1 instead of say 5. Have I done something wrong?

Cheers in advance
Reply With Quote
  #2 (permalink)  
Old January 11th, 2007, 09:44 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi In Distress,

Your query seems fine and you have proven that with your data preview.
From your previous question I would have expected this assignment to work but as I said before it suprised me that it did at all.
If you could try the assignment again with the full syntax and let me know how that goes.
Me.Prospect_CallDetailsTableAdapter.FindNextCall(M e.DataSet1.Prospect_CallDetails).Tables[0]["ID"].ToString();
Again, I haven't tested the syntax, but should be pretty close, your intellisence should be able to straighten it out if there is any syntax errors
Rod



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #3 (permalink)  
Old January 11th, 2007, 11:21 PM
Registered User
 
Join Date: Jan 2007
Location: , New South Wales, Australia.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rod,

I tried your suggestion but it seemed to be a no go. When I placed a fullstop after "(Me.DataSet1.Prospect_CallDetails)" the intellisense doesn't seem to kick in, almost as though it has recognised that the closed brackets signifies the end of the call. If I continue you to type it irrespective of this, I get a syntax error under the 0 in the "[0]" with an error that says "Identifier expected. There is also a blue squigly line under "Me.Prospects_DetailsTableAdapter.FindNextCall ", with the message "'FindNextCall' is not a member of 'WindowsApplication1.DataSet1TableAdapters.Prospec t_CallDetailsTableAdapter'".

Any thoughts, or am i just so thick that I've missed something obvious?

Reply With Quote
  #4 (permalink)  
Old January 12th, 2007, 12:55 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi,
This is a type
Code:
Me.DataSet1.Prospect_CallDetails
and should be used like this to instansiate an instance of it.
Code:
Me.DataSet1.Prospect_CallDetails ds = new Me.DataSet1.Prospect_CallDetails();
Then you use the ds when passing as a paramter.
However, that would pass an empty datatable to that method, which I doubt is your intent, but I may be wrong, I dont know your business needs.

At any rate I would have expected the compiler to complain about the paramter not the method.

So can you confirm that the .FindNextCall method exists and tell me what its parameter type is?

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #5 (permalink)  
Old January 12th, 2007, 01:19 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Sorry, I've mixed my languages in this, you are using VB.
I cant say for sure wha the VB syntax is off hand but the I think its something like
dim ds as new Me.DataSet1.Prospect_CallDetails




======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning Null Values in a query dstein4d Access VBA 2 March 21st, 2008 03:59 PM
Query returning all records - why? Toiletbrush Infopath 1 November 21st, 2007 03:19 AM
Query returning No Records englandera Classic ASP Databases 2 November 22nd, 2004 10:54 AM
Returning a result from a db function not allowed? treycarroll Beginning PHP 2 March 17th, 2004 07:53 PM
Returning ONLY the latest records in a query kilkerr1 Access 3 November 3rd, 2003 01:03 PM



All times are GMT -4. The time now is 12:51 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.