Well, that just returns a DataSet so it should be pretty trivial:
DataSet found = recherche("356885021519453");
if (found.Tables.Count > 0)
{
DataTable dt = found.Tables[0];
if (dt.Rows.Count > 0)
{
myTextBox.Text = (string)dt.Rows[0]["code_mck"];
}
}
But please, don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.
And your
try...catch
block doesn't actually do anything...
Try this:
public DataSet recherche(string code)
{
DataSet ds = null;
using (OleDbConnection cnn = new OleDbConnection(strConn))
{
cnn.Open();
string Oledb = "SELECT * FROM Code WHERE Imei=@IMEI";
using (OleDbDataAdapter adapter = new OleDbDataAdapter(Oledb, cnn))
{
adapter.SelectCommand.Parameters.AddWithValue("@IMEI", code);
ds = new DataSet();
adapter.Fill(ds, "Code");
}
}
return ds;
}