This will probably get marked as dublicate or get closed, but I need to ask. What is illegal here?
private void btnFind_Click(object sender, EventArgs e)
{
connection.Open();
OleDbCommand command1 = new OleDbCommand();
command1.Connection = connection;
command1.CommandText = "select antonym from antonymsdb where word ='" + txtWord.Text + "'";
string antonymdoc = command1.ExecuteScalar().ToString();
lblAntonym.Text = antonymdoc;
OleDbCommand command2 = new OleDbCommand();
command2.Connection = connection;
command2.CommandText = "select word from antonymsdb where antonym = '" + txtWord.Text + "'";
string antonymdocx = command2.ExecuteScalar().ToString();
lblAntonym.Text = antonymdocx;
connection.Close();
}
I'm trying to read both columns word and antonym and return the word of the same row, just different column. It keeps showing error and I tried searching the Internet, but found nothing helpful...