IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

Alimentation d'une base de donnée sql server


Sujet :

Windows Forms

  1. #1
    Membre à l'essai
    Profil pro
    Étudiant
    Inscrit en
    Avril 2008
    Messages
    24
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2008
    Messages : 24
    Points : 18
    Points
    18
    Par défaut Alimentation d'une base de donnée sql server
    Bonjour,

    Je suis sur Visual studio 2008 et Sql Developpeur 2005, je dois crée une interface graphique pour l'utilisation et l'alimentation de ma base de donnée:

    Elle comprend
    Table Films:
    Titre (cle primaire)

    Table Acteurs:
    NomPrenomAct(cle primaire)
    NomAct
    PrenomAct

    Table Proprietaire:
    NomPrenomProprio (cle primaire)
    NomPropr
    PrenomProp

    Table Genre
    DescriptionGenre (cle primaire)

    Table Stockage
    DescriptionStokage (cle primaire)

    Table List
    Titre (cle etrangere de film)
    NomPrenomAct (cleEtrangere de Acteur)
    NomPrenomProp (cleEtrangere de Proprietaire)
    Genre ( cle etrangere de Genre)
    Stock (cle etrangere de Stockage)
    Index (cle primaire)

    Je veux pouvoir allimenter mes table par l'interface graphique,
    cependant lorsque je cree une windows form (tout mon programme est en windows form je suis passer par l'interface graphique de visual studio car je debute en .net) et je rajoute des combo box (pour lire les valeur de chaque table (genre, stock, acteur, proprio) pour que l'utilisateur remplisse le champ titre du film et choississe apres dans des combo box le reste des champs.

    Normalment quand il clike sur OK la table List a une nouvelle instance et la table Film a un nouveau titre.

    Hors voila quand je veu tester ma fenetre il me met une erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    L'exception System.Data.ConstraintException n'a pas été gérée
      Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
      Source="System.Data"
      StackTrace:
           at System.Data.DataSet.FailedEnableConstraints()    at System.Data.DataSet.EnableConstraints()    at System.Data.DataSet.set_EnforceConstraints(Boolean value)    at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)    at WindowsApplication1.VideoTech4DataSetTableAdapters.ActeursTableAdapter.Fill(ActeursDataTable dataTable) in C:\Users\Psyrio\Documents\Visual Studio 2008\Projects\VIdeotech\VIdeotech\VideoTech4DataSet.Designer.vb:line 3236    at WindowsApplication1.AjouterUnFilm.AjouterUnFilm_Load(Object sender, EventArgs e) in C:\Users\Psyrio\Documents\Visual Studio 2008\Projects\VIdeotech\VIdeotech\AjouterUnFilm.vb:line 7    at System.Windows.Forms.Form.OnLoad(EventArgs e)    at System.Windows.Forms.Form.OnCreateControl()    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    at System.Windows.Forms.Control.CreateControl()    at System.Windows.Forms.Control.WmShowWindow(Message& m)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)    at System.Windows.Forms.ContainerControl.WndProc(Message& m)    at System.Windows.Forms.Form.WmShowWindow(Message& m)    at System.Windows.Forms.Form.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)    at System.Windows.Forms.Control.SetVisibleCore(Boolean value)    at System.Windows.Forms.Form.SetVisibleCore(Boolean value)    at System.Windows.Forms.Control.Show()    at WindowsApplication1.MenuPrincipal.AjFilm_Click(Object sender, EventArgs e) in C:\Users\Psyrio\Documents\Visual Studio 2008\Projects\VIdeotech\VIdeotech\MenuPrincipal.vb:line 4    at System.Windows.Forms.Control.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ButtonBase.WndProc(Message& m)    at System.Windows.Forms.Button.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.Run(ApplicationContext context)    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    at System.Threading.ThreadHelper.ThreadStart()
      InnerException:
    Cela vien de la ligen de code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Private Sub AjouterUnFilm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'TODO : cette ligne de code charge les données dans la table 'VideoTech4DataSet.Acteurs'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.ActeursTableAdapter.Fill(Me.VideoTech4DataSet.Acteurs)
            'TODO : cette ligne de code charge les données dans la table 'VideoTech4DataSet.Stockage'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.StockageTableAdapter.Fill(Me.VideoTech4DataSet.Stockage)
            'TODO : cette ligne de code charge les données dans la table 'VideoTech4DataSet.Genre'. Vous pouvez la déplacer ou la supprimer selon vos besoins.
            Me.GenreTableAdapter.Fill(Me.VideoTech4DataSet.Genre)
     
        End Sub
    Voila a ce que j'ai compris il y a un probleme de droit avec la cle primaire dans la table proprietaire et dans la table Acteur (il fait la meme erreur avec la table acteur) je pense que c'est quand je demande de choisir un nom et un prenom dans 2 combo box differentes, mais bon après je ne sais pas trop comment le resoudre.

    Si quelqun 'un peut m'aider car cela fait 4 jour que je suis dessus et cela me rend dingue lol

  2. #2
    Membre à l'essai
    Profil pro
    Étudiant
    Inscrit en
    Avril 2008
    Messages
    24
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2008
    Messages : 24
    Points : 18
    Points
    18
    Par défaut
    Personne pour m'aider?

Discussions similaires

  1. [SQL-Server] Connexion à une base de donnée SQL Server
    Par dieudo dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 15/05/2006, 14h00
  2. Réponses: 4
    Dernier message: 18/01/2006, 21h30
  3. Importation d'une base de donnée sql server vers oracle
    Par delphy456 dans le forum MS SQL Server
    Réponses: 9
    Dernier message: 17/01/2006, 14h44
  4. Réponses: 3
    Dernier message: 01/09/2005, 16h24
  5. Réponses: 3
    Dernier message: 29/03/2004, 18h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo