MoonDay

MoonDay

  • NA
  • 1
  • 896

Open a link from MS-Access database file

Mar 9 2014 7:12 AM
Hi
Why this code return two string from database? p as string fill with an address like: F:\Database\Balah#F:\Database\Balah#
DataSet DSOne = new DataSet();
OleDbDataAdapter adp = new OleDbDataAdapter();
private void button2_Click(object sender, EventArgs e)
{

adp.SelectCommand = new OleDbCommand();
adp.SelectCommand.Connection = oleDbConnection1;
adp.SelectCommand.CommandText = @"SELECT Folder FROM Movakelin
WHERE OfficeNumber LIKE ? or OfficialDossier LIKE ? or Family LIKE ? or
FirstName LIKE ? or approve LIKE ? or Folder LIKE ? or City LIKE ? or
Department LIKE ? or Organization LIKE ?";
string parameterValue = "%" + textBox1.Text + "%";

adp.SelectCommand.Parameters.AddWithValue("@p1", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p2", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p3", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p4", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p5", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p6", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p7", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p8", parameterValue);
adp.SelectCommand.Parameters.AddWithValue("@p9", parameterValue);

adp.Fill(DSOne, "Folder");
if (DSOne.Tables[0].Rows.Count > 0)
{
string p = DSOne.Tables[0].Rows[0]["Folder"].ToString();
string args = string.Format("/e, /select, \"{0}\"", p);
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = "explorer";
info.Arguments = args;
Process.Start(info);
}

Answers (1)