Answered by:
If Data Exist

Question
-
User-1031608939 posted
Hi,
For MS Access, how to check if the particular field data exist?
Thanks.
Regards,
ling
Friday, March 18, 2011 5:26 AM
Answers
-
User-1199946673 posted
I'm not sure exactly waht you mean? But waht about:
(SELECT COUNT(*) FROM [tablename] WHERE .....) > 0
This will return True if the data exist and false if no records are found...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 18, 2011 8:45 AM
All replies
-
User1949625403 posted
hi check this post here i explained how to check particular field data exists or not
http://aspdotnet-suresh.blogspot.com/2010/10/introduction-here-i-will-explain-how-to.html
Friday, March 18, 2011 6:57 AM -
User-1199946673 posted
I'm not sure exactly waht you mean? But waht about:
(SELECT COUNT(*) FROM [tablename] WHERE .....) > 0
This will return True if the data exist and false if no records are found...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, March 18, 2011 8:45 AM -
User-1199946673 posted
hi check this post here i explained how to check particular field data exists or not
http://aspdotnet-suresh.blogspot.com/2010/10/introduction-here-i-will-explain-how-to.html
He's using ACCESS!!!!!
Friday, March 18, 2011 8:48 AM -
User3866881 posted
Try something like this:
using(OleDbCommand cmd = new OleDbCommand("SELECT COUNT(*) FROM [tablename] WHERE .....",new OleDbConnection("……"))
{
int number = Convert.ToInt(cmd.ExecuteScaler());
if(number>0)
{
//Do what you want……
}
}
Monday, March 21, 2011 12:30 AM