TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ozzy
NA
13
0
How to check if value exist in database
Mar 11 2010 2:04 PM
I have a value let's say it's "3243"; and my database table name is "mytable" and the column I'll look into is "mycolumn". I want to check if this value exist in that column.
I do have a dataset and I tried the following code :
DataTable table = dsEditData.Tables["mytable"];
DataRow[] row;
row = table.Select("mycolumn = '3243'");
MessageBox.Show(row[0][0].ToString());
but this code gives me the error "There is no row at position 0."
Database table is not empty and I'm %100 sure that the row I'm looking for exist. I've never used these codes. So it might be totally wrong. I want to know if I need to correct my code or if there is any other way to do what I want to do.
Reply
Answers (
3
)
TreeView C#
SplitterContainer