9 Replies - 662 Views - Last Post: 07 December 2011 - 03:41 PM Rate Topic: -----

#1 WabiSabi  Icon User is offline

  • D.I.C Head

Reputation: 51
  • View blog
  • Posts: 202
  • Joined: 31-December 10

Querybuilder works fine, actual query does not

Posted 06 December 2011 - 03:56 PM

Can anyone tell me WHY my query returns correct results when I use the query builder and execute the query, but it tells me it "Failed to enable constraints" when the program tries to execute the same query? (using the SAME data for input)

Even though (so far) I eventually find a way to make the query work, this keeps happening and it is driving me nuts!
Is This A Good Question/Topic? 0
  • +

Replies To: Querybuilder works fine, actual query does not

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Querybuilder works fine, actual query does not

Posted 06 December 2011 - 04:47 PM

You know what drives me nuts? When somebody asked why their code(or query) doesn't work, BUT DOESN'T POST THE CODE/QUERY!! I mean, really? How are we suppose to know why it doesn't work? You haven't shown us anything.

Post the code(including the code that calls the query). We can then look and see if we see the problem.
Was This Post Helpful? 1
  • +
  • -

#3 WabiSabi  Icon User is offline

  • D.I.C Head

Reputation: 51
  • View blog
  • Posts: 202
  • Joined: 31-December 10

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 07:57 AM

I'm sorry. I figured that there may be a reason this happens... and the code would not be necessary. (Since it happens a lot, with different queries)

But I can't risk showing the actual code... it may get me in trouble.
:(
Was This Post Helpful? 0
  • +
  • -

#4 RexGrammer  Icon User is offline

  • Coding Dynamo
  • member icon

Reputation: 181
  • View blog
  • Posts: 777
  • Joined: 27-October 11

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 08:06 AM

How would you expect someone to help you if he doesn't know what bothers you?

Didn't you see the big text above when you were posting your problem...

You would've seen this:

Quote

Post your code between [code [/code] tags
Include details about errors and what your question is


After 120+ posts you shouldn't be told this... :)

There are no generic answers to these types of questions...

Posted Image
Was This Post Helpful? 0
  • +
  • -

#5 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 08:46 AM

View PostWabiSabi, on 07 December 2011 - 10:57 AM, said:

I'm sorry. I figured that there may be a reason this happens... and the code would not be necessary. (Since it happens a lot, with different queries)

But I can't risk showing the actual code... it may get me in trouble.
:(


Then you should consult your professor(if a student) or manager/colleague(if employed) about this issue.
Was This Post Helpful? 1
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 08:49 AM

Is there more info than "Failed to enable constraints"? A quick Google seems to indicate that the most common explanation would be one of your values for a non-NULL database column is in fact NULL.
Was This Post Helpful? 1
  • +
  • -

#7 WabiSabi  Icon User is offline

  • D.I.C Head

Reputation: 51
  • View blog
  • Posts: 202
  • Joined: 31-December 10

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 09:49 AM

Thank you, Jack, for actually trying to be helpful rather than insulting.

In the query builder, none of the values returned are null. I also tried the query in Excel, and it gave me the message "SQL query can't be represented graphically" but it still returns a table (or whatever that is called in Excel)

Using a try/catch and ignoring the exception will make the FILL work with this query, but the GET still returns an empty table.




:offtopic:

View PostRexGrammer, on 07 December 2011 - 09:06 AM, said:

How would you expect someone to help you if he doesn't know what bothers you?

Didn't you see the big text above when you were posting your problem...

You would've seen this:

Quote

Post your code between [code [/code] tags
Include details about errors and what your question is



Didn't YOU see the above text in red when you were posting your insult:

DO NOT
Be rude or hijack topics just to criticize the OP

This post has been edited by WabiSabi: 07 December 2011 - 10:16 AM

Was This Post Helpful? 0
  • +
  • -

#8 RexGrammer  Icon User is offline

  • Coding Dynamo
  • member icon

Reputation: 181
  • View blog
  • Posts: 777
  • Joined: 27-October 11

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 09:50 AM

HAHAHA! You've got me...
Was This Post Helpful? 0
  • +
  • -

#9 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 10:42 AM

I cut you some slack on the lack of code knowing you've been very helpful to others in the past, and suspecting it was work-related.

Unfortunately, I can't be much more help as I've not worked much with what you're working with. Can you give us any more info on the query? Where you refer to it as a GET, I assume it's a simple SELECT into perhaps a DataTable or something. As a guess in that case I would say that the control into which you're selecting data may have constraints on it but the data retrieved does not satisfy those constraints. Could see that happening if the database's constraints don't line up with the local ones.
Was This Post Helpful? 1
  • +
  • -

#10 WabiSabi  Icon User is offline

  • D.I.C Head

Reputation: 51
  • View blog
  • Posts: 202
  • Joined: 31-December 10

Re: Querybuilder works fine, actual query does not

Posted 07 December 2011 - 03:41 PM

Thanks, Jack. I kind of thought it was something like that, myself.

I have been able to solve this problem though. For this query. But I expect it will happen again soon.

I had a syntax error... and I used a different table to execute the query from. It works now so I'm leaving it alone.
:)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1