Hi, After some search,I elaborate this code that still annoying :(( me with some errors:
private void button1_Click(object sender, EventArgs e)
{
//Create the connection
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(wCS);
//Create the command
SqlCeCommand command = sqlceconn.CreateCommand();
command.CommandText = "Select NBT, Nature from Travaux where NBT=@NBT ";
//Add the parameters
string s1 = textBox1.Text; //store the login name here YOU MUST FILL THIS IN
SqlCeParameter NBT = new SqlCeParameter("@NBT", SqlDbType.NVarChar);
NBT.Value = s1;
command.Parameters.Add(NBT);
//Create the adapter
SqlCeDataAdapter adapter = new SqlCeDataAdapter(command);
//Create and fill the dataset
DataSet ds = new DataSet();
try
{
adapter.Fill(ds, "SQL Temp Table");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
foreach (DataRow da in adapter)
{ string s = adapter\["Nature"\]; }
if ((ds.Tables.Count > 0) && (ds.Tables\["SQL Temp Table"\] != null))
{
MessageBox.Show("Number of row(s) - " + ds.Tables\["SQL Temp Table"\].Rows.Count);
if (ds.Tables\["SQL Temp Table"\].Rows.Count > 0)
{
MessageBox.Show("Numéro de BT trouvé");
SqlCeCommand command1 = sqlceconn.CreateCommand();
command1.CommandText = "Select NoEtape, Etape from Travaux where TypeTravail=@typ ";
//Add the parameters
string s2 = textBox1.Text; //store the login name here YOU MUST FILL THIS IN
SqlCeParameter Typ = new SqlCeParameter("@Typ", SqlDbType.NVarChar);
Typ.Value = s2;
command1.Parameters.Add(Typ);
SqlCeDataAdapter adapt = new SqlCeDataAdapter(command1);
//Create and fill the dataset
DataSet dat = new DataSet();
try
{
adapt.Fill(dat, "SQL Temp Table");
}
catch (Exception ex)
{