Bonjour tout le monde,

Je viens chercher de l'aide car je n'arrive pas à m'en sortir avec le déploiement de mon application et l'accès à la base de donnée.
J'utilise visual Studio 2012 avec le .Net 4.5
Pour tout vous expliquer, j'ai tenté le déploiement avec clickOnce.
J'utilise Microsoft SQL Server 2012 avec une authentification Windows.
J'ai une classe qui gère l'accès à ma base de donnée.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DAL
{
    public class BDAcces
    {
        private static IDbConnection _ctn = new SqlConnection("Data Source=LABOICH;Initial Catalog=TEST;Integrated Security=True");
 
        public static IDbConnection connexion
        {
            get
            {
                return _ctn;
            }
        }
        public static void ConnexionBDD()
        {
            IDbConnection ctn = new SqlConnection("Data Source=LABOICH;Initial Catalog=TEST;Integrated Security=True");
            ctn.Open();
        }
 
        public static void creerParametre(IDbCommand commande, string nom, object valeur, DbType type)
        {
            IDbDataParameter param = commande.CreateParameter();
            param.ParameterName = "@" + nom;
            param.Value = valeur;
            param.DbType = type;
            commande.Parameters.Add(param);
        }
    }
}
et voici un exemple d'une de mes méthodes faisant appel à la base.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
    public List<EntiteParametresPartie> ChargerListeParametresPartie()
    {
        List<EntiteParametresPartie> listeARetourner = new List<EntiteParametresPartie>();
 
        try
        {
            IDbCommand cmd = BDAcces.connexion.CreateCommand();
            cmd.CommandText = "SELECT * FROM ParametresPartie";
            if (BDAcces.connexion.State != ConnectionState.Open) BDAcces.connexion.Open();
 
            IDataReader lecteur = cmd.ExecuteReader();
            while (lecteur.Read())
            {
                int idParametresPartie = lecteur.GetInt32(0);
                int idParametresPrincipaux = lecteur.GetInt32(1);
                int nbNumACocher = lecteur.GetInt32(2);
 
                listeARetourner.Add(new EntiteParametresPartie(idParametresPartie,idParametresPrincipaux,nbNumACocher));
            }
            lecteur.Close();
        }
        catch (Exception)
        {
 
            throw;
        }
        finally
        {
            if (BDAcces.connexion.State != ConnectionState.Closed && BDAcces.connexion.State != ConnectionState.Broken)
                BDAcces.connexion.Close();
        }
        return listeARetourner;
    }
Mon app.config ne contient rien
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
Et concernant le déploiement avec clickOnce, je pensais déployer dans un dossier (pour pouvoir ziper le fichier d'installation et l'envoyer par mail).
Concernant la partie fichier d'application (clic droit sur le projet principal, propriétés, onglet Publier)
Nom de fichier / Etat publication / Groupe de téléchargement / Hachage
BLL.dll Inclure (Auto) (Requis) Inclure
BLL.pdb Inclure (Requis) Inclure
BO.dll Inclure (Auto) (Requis) Inclure
BO.pdb Inclure (Requis) Inclure
DAL.dll Inclure (Requis) Inclure
DAL.pdb Fichier de données (Requis) Inclure
MatriceBuilder.dll Inclure (Auto) (Requis) Inclure
MatriceBuilder.pdb Inclure (Requis) Inclure
Methodes.dll Inclure (Auto) (Requis) Inclure
Methodes.pdb Inclure (Requis) Inclure
PointsBuilder.dll Inclure (Auto) (Requis) Inclure
PointsBuilder.pdb Inclure (Requis) Inclure
WindowsFormsApplication1.exe Inclure (Auto) (Requis) Inclure
WindowsFormsApplication1.exe.config Inclure (Auto) (Requis) Inclure
WindowsFormsApplication1.exe.manifest Inclure (Auto) (Requis) Inclure
WindowsFormsApplication1.pdb Inclure (Requis) Inclure

Concernant les composantes requis à installer, j'avais coché un peu au hasard :
- Microsoft .NET Framework 4.5(x86 et x64)
- SQL Server 2008 R2 Express
- SQL Server 2012 Express
- SQL Server 2012 Express local DB
- Types CLR du système Microsoft pour SQL Server 2012 (x64)
- Types CLR du système Microsoft pour SQL Server 2012 (x86)
- Windows Installer 4.5

et j'ai coché : Télécharger les composants à partir du site Web du fournisseur de composants

Concernant les options j'ai rien renseigné de bien spécial..

Je reste ouvert à toutes suggestions, merci d'avance pour votre aide.

laboich