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
Israel
699
1.3k
217.3k
Doesnt search the right data from Database
Apr 27 2019 8:30 AM
Hi,
I have data into my DB (five records). When I search for example the number "3" its sturk and give the error message: the parameter it's not valide. Curiosly all number out of numbers inside of my DB (1,2,3,4,5) its says "Data not find".
private
void
button2_Click(
object
sender, EventArgs e)
{
conn.Open();
string
sqlQuery =
"select * from test where id ='"
+ textID.Text +
"'"
;
cmd =
new
SqlCommand(sqlQuery, conn);
SqlDataReader DataRead = cmd.ExecuteReader();
DataRead.Read();
if
(DataRead.HasRows)
{
textName.Text = DataRead[1].ToString();
byte
[] img = ((
byte
[])DataRead[2]);
if
(img ==
null
)
{
pictureBox1.Image =
null
;
}
else
{
MemoryStream mstream =
new
MemoryStream(img);
pictureBox1.Image = Image.FromStream(mstream);
// Its sturk here on this line
}
}
else
{
MessageBox.Show(
"Data not find"
);
}
conn.Close();
}
Reply
Answers (
8
)
calculate km from source to destination using lat n long
Dependency Injection