title: c# program error in sql syntax
body: <p>i am trying to create a program that returns an array of value from a mysql database(db). The program will receive user input and it will be split into substrings, after that the substrings will be compared to the db and it will return an array of values. However I still couldn't get it to work properly. Is there something wrong with my loop function or maybe the label?
  here is the program code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  using MySql.Data.MySqlClient;
  
  namespace jawiFin
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
          MySqlConnection myConn = new MySqlConnection("datasource=localhost;port=3306;username=root;password=971476");
  
          MySqlCommand mcd;
          MySqlDataReader mdr;
          string s;
          private void button1_Click(object sender, EventArgs e)
          {
  
              string strValue = textBox1.Text;
              string[] strArray = strValue.Split(',',' ');
              foreach (object obj in strArray)
              {
                  myConn.Open();
  
                  s = "select * from database01.employeeinfo where name='" + this.textBox1.Text + "';";
                  mcd = new MySqlCommand(s, myConn);
                  mdr = mcd.ExecuteReader();
                  if (mdr.Read())
                  {
  
                          trans.Text += mdr.GetString("surname");
  
                  }
                  else
                  {
                      MessageBox.Show("error");
                  }
                  mdr.Close();
                  myConn.Close();
              }
          }
      }
  }
  </code></pre>