public string SelectSociete(String nom) { //Object MysqlConnection MySqlConnection connection; string server; string database; string uid; string password; server = "localhost"; database = "gare_tetouan"; uid = "root"; password = ""; string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";"; connection = new MySqlConnection(connectionString); connection.Open(); string query = "SELECT nom_societe FROM `societe`"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) // If you're expecting only one line, change this to if(reader.Read()). { //nom = reader.GetString(1); nom = reader["nom_societe"].ToString(); } // nom=(String)cmd.ExecuteScalar(); //fermeture de la connection reader.Close(); connection.Close(); return nom; }
private void button1_Click(object sender, RoutedEventArgs e) { string text= ""; text = textBox2.Text; ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); client.SelectSocieteAsync(text); }
public List<string> SelectSociete(String nom) { List<string> lstnom=new List<string>(); //Object MysqlConnection MySqlConnection connection; string server; string database; string uid; string password; server = "localhost"; database = "gare_tetouan"; uid = "root"; password = ""; string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";"; connection = new MySqlConnection(connectionString); connection.Open(); string query = "SELECT nom_societe FROM `societe`"; MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) // If you're expecting only one line, change this to if(reader.Read()). { //nom = reader.GetString(1); lstnom.Add(reader["nom_societe"].ToString()); } // nom=(String)cmd.ExecuteScalar(); //fermeture de la connection reader.Close(); connection.Close(); return lstnom; }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); foreach(String s in client.SelectSocieteAsync("xxxx")) ComboBox1.Items.Add(s); }
ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); foreach (String s in client.SelectSocieteAsync("xxxx")) this.listpicker.Items.Add(s);
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionList<string> list = new List<string>(); ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); client.SelectSocieteAsync(list); this.listpicker.Items.Add(list);
this.listpicker.ItemsSource = list;
List<string> list = new List<string>(); ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); client.SelectSocieteAsync(list); this.listpicker.Items.Add(list);
this.listpicker.ItemsSource=client.SelectSocieteAsync("xxxx"); //ou List<string> list = new List<string>(); ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); list=client.SelectSocieteAsync(list); this.listpicker.ItemsSource=list;
public List<string> SelectSociete() { List<string> nom = new List<string>(); //Object MysqlConnection MySqlConnection connection; string server; string database; string uid; string password; server = "localhost"; database = "gare_tetouan"; uid = "root"; password = ""; string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";"; connection = new MySqlConnection(connectionString); connection.Open(); string query = "SELECT nom_societe FROM `societe`"; MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) // If you're expecting only one line, change this to if(reader.Read()). { //nom = reader.GetString(1); nom.Add(reader["nom_societe"].ToString()); } reader.Close(); connection.Close(); return nom; }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { List<string> list = new List<string>(); ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); client.SelectSocieteCompleted += new EventHandler<SelectSocieteCompletedEventArgs>(client1_SelectSocieteCompleted); client.SelectSocieteAsync(list); // MessageBox.Show(list.Count.ToString()); } private void client1_SelectSocieteCompleted(object obj, ServiceConsum.SelectSocieteCompletedEventArgs e) { if (e.Error == null) { this.listpicker.ItemsSource = e.Result; //Message de succés MessageBox.Show("ca marche !"); } else { MessageBox.Show(e.Error.ToString()); } }
<!--LayoutRoot est la grille racine où tout le contenu de la page est placé--> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--Titleanel contient le nom de l'application et le titre de la page--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="MON APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="Votre autocar" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel> <!--ContentPanel - placez tout contenu supplémentaire ici--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <toolkit:ListPicker Header="Choisir un Autocar" x:Name="listpicker" Margin="12,27,23,180" /> </Grid> </Grid>
private async void button1_Click(Sender s,Object e){ List<string> list = new List<string>(); ServiceConsum.Service1Client client = new ServiceConsum.Service1Client(); this.listpicker.ItemsSource=await client.SelectSocieteAsync("xxx"); }