بتاريخ: 26 ديسمبر 20196 سنة comment_299862 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Entity; import company.Tools; import javax.swing.JTable; /** * * @author wall moh */ public class Project implements MainData { private int ProjectNO; private String ProjectName; private String Location; private String DeptNo; public int getProjectNO() { return ProjectNO; } public static void main(String[]args){ } public void setProjectNO(int ProjectNO) { this.ProjectNO = ProjectNO; } public String getProjectName() { return ProjectName; } public void setProjectName(String ProjectName) { this.ProjectName = ProjectName; } public String getLocation() { return Location; } public void setLocation(String Location) { this.Location = Location; } public String getDeptNo() { return DeptNo; } public void setDeptNo(String DeptNo) { this.DeptNo = DeptNo; } @Override public void add() { //تكوين جمله الانسيرت String strInsetrt="insert into project values(" + ProjectNO + "," + "'" + ProjectName + "'," + "'" + Location + "'," + DeptNo + ")"; boolean isAdd= db.go.runNonQuery(strInsetrt); if(isAdd){ Tools.msgBox("Project Is Added..."); } } @Override public void update() { //تكوين جمله الابديت String strUpdate ="update project set " + "ProjectName='" + ProjectName + "'," + "Location='" + Location + "'," + "DepartNo=" + DeptNo + " where projectNo=" + ProjectNO; boolean isUpdate=db.go.runNonQuery(strUpdate); if(isUpdate){ Tools.msgBox("Project Is Update..."); } } @Override public void delete() { String strDeleate ="delete from project " + " where projectNo=" + ProjectNO; boolean isDelete=db.go.runNonQuery(strDeleate); if (isDelete){ Tools.msgBox("Project Is Deleted..."); } } @Override public String getAutoNumber() { return db.go.getAutoNumber("project", "projectNO"); } @Override public void getAllRows(JTable table) { db.go.fillToJTable("Project_Data", table); } @Override public void getOneRow(JTable table) { String strSelect="select * from Project_Data" + " where project_No=" + ProjectNO; db.go.fillToJTable(strSelect, table); } @Override public void getCustomRows(String statement, JTable table) { db.go.fillToJTable(statement, table); } @Override public String getValueByName(String name) { String strSelect="select projectNO from project" + " where projectName='" + name + "'"; //عمل متغير نشيل فيه المتغير String strVal= (String)db.go.getTableData(strSelect).Items[0][0]; return strVal; } @Override public String getNameByValue(String value) { String strSelect="select projectName from project" + " where projectNO='" + value + "'"; String strName= (String)db.go.getTableData(strSelect).Items[0][0]; return strName; } } هنا الخطاء : Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException run: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at db.go.getTableData(go.java:139) at Entity.Project.getValueByName(Project.java:123) at forms.frmTest.btnTestProjectActionPerformed(frmTest.java:217) at forms.frmTest.access$400(frmTest.java:18) at forms.frmTest$5.actionPerformed(frmTest.java:89) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) BUILD SUCCESSFUL (total time: 6 seconds) تم تعديل 26 ديسمبر 20196 سنة بواسطة ابراهيم وليد تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.