1

i want display 1 record from colums zodys, I'm programint in C#

I have table test and I want select row zodys

SELECT top 1 zodys from test ORDER BY rnd(zodys)

I get error: Data type mismatch in criteria expression.

2 Answers 2

1

Sadly being without the ability to test, but Rnd in Access queries takes a numeric parameter, so I presume zodys is not numeric.

Here's an entire article on the subject of random sorting in Access.

2
  • Thanks I will use this SELECT top 1 zodys from test ORDER BY Rnd(-(6*ID)*time());
    – Wizard
    Mar 30, 2012 at 18:22
  • Updated the answer with a better reference. Mar 31, 2012 at 4:39
1

What is the data type of [zodys]? If it's text, that is why you're getting "Data type mismatch in criteria expression."

If you get that error message with [zodys] as a numeric data type, look at Rnd Function from Microsoft Office documentation for an explanation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.