Probleme de modification dans une base sql server express edition

Signaler
Messages postés
20
Date d'inscription
samedi 28 février 2004
Statut
Membre
Dernière intervention
11 janvier 2009
-
Messages postés
16
Date d'inscription
mercredi 17 septembre 2003
Statut
Membre
Dernière intervention
6 octobre 2008
-
bonsoir,

mon probleme est quand je veux modifier ou supprimer un enregistrement dans une base sql server express ile m'affiche cet erreur

System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="test"
  StackTrace:
       at test.Form1.Button2_Click(Object sender, EventArgs e) in C:\Documents and Settings\Choual Mounir\Bureau\Setup1\test\test\Form1.vb:line 24
       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 test.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()

 

vooila mon code:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim modif As testDataSet.T_testRow

        modif = Me.TestDataSet.T_test.FindBynum(numero.text)

        modif.num = numero.Text
        modif.nom = nom.Text
        modif.prenom = prenom.Text
        modif.adresse = adresse.Text
        modif.tel = tel.Text
        Me.T_testTableAdapter.Update(Me.TestDataSet.T_test)
        MsgBox("bien modifier")
    End Sub

ce code existe dans le lien suivant : http://msdn.microsoft.com/fr-fr/library/ms233819.aspx

1 réponse

Messages postés
16
Date d'inscription
mercredi 17 septembre 2003
Statut
Membre
Dernière intervention
6 octobre 2008

salut,
 à mon avis ta fonction 
Me.TestDataSet.T_test.FindBynum(numero.text) renvoit nothing

SeeD2018