[C#] dataset typés

philo71 Messages postés 28 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 10 mars 2008 - 7 mars 2006 à 15:40
imfloflo Messages postés 2 Date d'inscription mercredi 7 juillet 2004 Statut Membre Dernière intervention 15 novembre 2006 - 15 nov. 2006 à 09:16
Bonjour,
Je développe un appli en C# 2003 avec SQL serveur 2000.
je cherche des infos sur les datasets typés, j'ai quelques questions a vous poser.
Je consoit le formulaire commande qui est composé de 4 tables : table_client,table_article,table_commande,table_ligne_commande.
Dans mon code je manipule 2 tables pour commencer, table_commande et table_client, mon dataset typé s'appel "Dataset_command".
Le workspace me renvoit aucune erreur mais il ne m'affiche pas les données dans mes datagrid, voici mon code :

using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data.SqlClient;

//using System.Data.SqlClient.SqlDataAdapter;
using System.Data;

.......
......


protected
const
string SQL_CONNECTION_STRING = "Server=localhost;DataBase=philo_es;Integrated Security=SSPI";

protected
const
string MSDE_CONNECTION_STRING = "Server=(local)\\NetSDK;DataBase=philo_es;Integrated Security=SSPI";

protected
const
string CONNECTION_ERROR_MSG = "To run this sample, you must have SQL or MSDE with the Northwind database installed. For instructions on installing MSDE, view the ReadMe file.";

protected
bool bolDidPreviouslyConnect =
false;

protected
bool bolDidCreateTable =
false;

protected
string connectionString = SQL_CONNECTION_STRING;

//public
static SqlCommand cmd;

//public
static SqlDataAdapter da =
new SqlDataAdapter(cmd);

// c'est ici que c'est intéréssant


// affichage du select



SqlConnection connexion =
new SqlConnection(connectionString);

SqlDataAdapter daClient =
new SqlDataAdapter("SELECT num_client ,nom_client , prenom_client, adr_client , tel_client FROM table_client ",connexion);



//Création du Premier DataAdpater pour la Table commande
SqlDataAdapter daCommande =
new SqlDataAdapter("SELECT num_commande,num_c_client,num_c_ligne_commande, desi_commande FROM table_commande",connexion);



try
{
connexion.Open();
daClient.ExecuteNonQuery(); // ici erreur

Dataset_command dsGestion =
new Dataset_command();
daClient.Fill(dsGestion, "table_client");

//daClient.DataSource = dsGestion;
//daClient.DataMember = "table_client";
daCommande.Fill(dsGestion, "table_commande");

...........
..........

Cdlt
PHILO

3 réponses

Arthenius Messages postés 1182 Date d'inscription mercredi 21 janvier 2004 Statut Membre Dernière intervention 6 septembre 2011 14
7 mars 2006 à 17:58
daClient.ExecuteNonQuery(); // ici erreur

ne sert a rien ici

^^

si tu veux tu peux jeter un oeuil aux sources que j'ai fait sur ce site, il y en a un qui traite des dataadapter & Co

<hr>Arthenius
http://blogs.developpeur.org/Arthenius/

"Ce qui ne me tue pas, me rend plus fort..."
0
imfloflo Messages postés 2 Date d'inscription mercredi 7 juillet 2004 Statut Membre Dernière intervention 15 novembre 2006
15 nov. 2006 à 09:15
si tu cherches encore depuis le temps il ya ca : http://www.supinfo-projects.com/fr/2005/datatype/1/
0
imfloflo Messages postés 2 Date d'inscription mercredi 7 juillet 2004 Statut Membre Dernière intervention 15 novembre 2006
15 nov. 2006 à 09:16
si tu cherches encore depuis le temps il ya ca : http://www.supinfo-projects.com/fr/2005/datatype/1/
0
Rejoignez-nous