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
635
1.3k
215.9k
Display ONLY the first record of datagrid from textbox on cl
Jan 18 2020 6:05 PM
Hi,
I wrote these codes to display the LAST row ONLY. Then how can I display ONLY the first row from textbox one click.
private void button_Click(object sender, EventArgs e)
{
string commandString = "select top 1 * from Test where name='" + txtNumber.Text ";
OleDbCommand sqlCmd = new OleDbCommand(commandString, sqlCon);
OleDbDataReader read = sqlCmd.ExecuteReader();
if (read.HasRows)
{
while (read.Read())
{
txtNumber.Text = read["number"].ToString();
}
}
else
{
MessageBox.Show("Name " + txtName.Text + " not found");
}
read.Close();
sqlCon.Close();
Reply
Answers (
1
)
What Are The Claims Of Ketovatru tablets?
Display before any row using "Button"