分类: 电脑/网络 >> 程序设计 >> 其他编程语言
问题描述:
在VFP中如何编写主程序?在编写主程序时应注意什么事项?
解析:
设置运行环境
Set Talk Off &&关闭命令显示
Set Escape Off &&禁止运行的程序在按 Esc 键后被中断
Set Exclusive Off &&数据库表以共享方式打开
Set Deleted On &&过滤掉已带删除标记的记录
Set Safety Off &&指定在改写已有的文件时不显示对话框
Set Date Ansi &&设定日期的年份为 4 位数
Set Century On &&指定日期表达式的显示格式为YYMMDD
SET MARK TO [-] &&指定日期的分隔符为"-"
SET SECONDS ON &&日期时间表达式的显示秒钟部分
SET HOURS TO 12 &&指定日期时间表达式的显示为12小时格式
Set Optimize ON &&启用或废止 Rushmore 优化。
Set ENGINEBEHAVIOR 70
Set DECIMALS TO 8 &&指定小数点位数,默认为2位
Clear &&清除主窗口
Clear All &&清除变量
开始进行程序的事务处理 *** 作
Public pcSys
pcSys=Sys(5)+Sys(2003)
Set Default To pcSys
Set Path To Class,Form,Poto,Menu,Prg,Report
DO form frmbegin &&运行启动画面表单frmBegin,名称自己改,
READ events
DO form frmlogin &&运行主界面表单frmlogin,名称自己改,
READ events
保存,名称自己安,然后设置为主文件
VFP是在WINDOWS下应用的数据库应用和编程软件,它的特点就是窗口,你在用一个表(dbf)想生成exe文件时缺少表单或标签的可视窗口的载入所以你必须创建表单或标签来应用你的数据表并在代码页中建立主程序用作应用程序的起始点
以下是MSDN的说明,供参考:
在建立应用程序时,需要考虑如下的任务:
设置应用程序的起始点。
初始化环境。
显示初始的用户界面。
控制事件循环。
退出应用程序时,恢复原始的开发环境。
下面将具体讨论这些任务。典型的情况是,可以建立一个应用程序对象来完成如上任务。请参阅在 Visual Studio …\Samples\Vfp98\Tastrade 目录下的 Tasmanian Traders 示例应用程序来了解详细的技术细节。同时,假设使用“应用程序向导”来编译应用程序,那么它会建立一个应用程序对象。如果需要的话,可以使用程序作为主文件来完成如上任务。有关详细内容,请参阅“将一个程序结构化为主文件”。
设置起始点
将各个组件链接在一起,然后使用主文件为应用程序设置一个起始点。主文件作为应用程序执行的起始点,可以包含一个程序或者表单。当用户运行应用程序时,Visual FoxPro 将为应用程序启动主文件,然后主文件再依次调用所需要的应用程序其他组件。所有应用程序必须包含一个主文件。一般来讲,最好的方法是为应用程序建立一个主程序。但是,使用一个表单作为主程序,可以将主程序的功能和初始的用户界面集成在一起。
如果使用应用程序向导建立应用程序,可让向导替您建立一个主文件程序。您无须自己专门来做,除非在向导完成之后,自己想改变主文件。
若要设置应用程序的起始点
在“项目管理器”中,选择要设置为主文件的文件。
从“项目”菜单中选择“设置主文件”命令。
注意 应用程序的主文件自动设置为“包含”。这样,在编译完应用程序之后,该文件作为只读文件处理。
项目中仅有一个文件可以设置为主文件。
我有个现成的,已发到您邮箱,请注意查收。
package student_manage;
import javaawt;
import javaxswing;
import comborlandjbcllayoutXYLayout;
import comborlandjbcllayout;
import comborlanddbswingJdbLabel;
import comborlanddbswingJdbTextField;
import comborlanddxsqldatasetDatabase;
import comborlanddxsqldataset;
import comborlanddbswingTableScrollPane;
import comborlanddbswingJdbTable;
import comborlanddbswingJdbNavToolBar;
import comborlanddbswingJdbStatusLabel;
import javaawteventActionEvent;
import javaawteventActionListener;
import javaawteventKeyEvent;
import javaawteventKeyAdapter;
import javasqlDriverManager;
import javasqlStatement;
import javasqlResultSet;
import javasqlConnection;
/
<p>Title: </p>
<p>Description: </p>
<p>Copyright: Copyright (c) 2007</p>
<p>Company: </p>
@author not attributable
@version 10
/
public class admin_index extends JDialog {
JPanel panel1 = new JPanel();
BorderLayout borderLayout1 = new BorderLayout();
JTabbedPane jTabbedPane1 = new JTabbedPane();
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JPanel jPanel5 = new JPanel();
XYLayout xYLayout2 = new XYLayout();
JdbLabel jdbLabel1 = new JdbLabel();
JdbLabel jdbLabel2 = new JdbLabel();
JdbTextField jdbTextField1 = new JdbTextField();
JdbTextField jdbTextField2 = new JdbTextField();
JPanel jPanel6 = new JPanel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
XYLayout xYLayout3 = new XYLayout();
JdbLabel jdbLabel3 = new JdbLabel();
JdbLabel jdbLabel4 = new JdbLabel();
JdbTextField jdbTextField3 = new JdbTextField();
JdbTextField jdbTextField4 = new JdbTextField();
XYLayout xYLayout4 = new XYLayout();
Database database1 = new Database();
QueryDataSet queryDataSet1 = new QueryDataSet();
TableScrollPane tableScrollPane1 = new TableScrollPane();
JdbTable jdbTable1 = new JdbTable();
JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel1 = new JdbStatusLabel();
XYLayout xYLayout5 = new XYLayout();
JPanel jPanel8 = new JPanel();
Database database2 = new Database();
QueryDataSet queryDataSet2 = new QueryDataSet();
TableScrollPane tableScrollPane2 = new TableScrollPane();
JdbTable jdbTable2 = new JdbTable();
JdbNavToolBar jdbNavToolBar2 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel2 = new JdbStatusLabel();
XYLayout xYLayout6 = new XYLayout();
Database database3 = new Database();
QueryDataSet queryDataSet3 = new QueryDataSet();
TableScrollPane tableScrollPane3 = new TableScrollPane();
JdbTable jdbTable3 = new JdbTable();
JdbNavToolBar jdbNavToolBar3 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel3 = new JdbStatusLabel();
JPanel jPanel10 = new JPanel();
XYLayout xYLayout7 = new XYLayout();
JPanel jPanel11 = new JPanel();
JPanel jPanel12 = new JPanel();
XYLayout xYLayout8 = new XYLayout();
JdbLabel jdbLabel5 = new JdbLabel();
JdbTextField jdbTextField5 = new JdbTextField();
Database database4 = new Database();
QueryDataSet queryDataSet4 = new QueryDataSet();
TableScrollPane tableScrollPane4 = new TableScrollPane();
JdbTable jdbTable4 = new JdbTable();
JdbNavToolBar jdbNavToolBar4 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel4 = new JdbStatusLabel();
Database database5 = new Database();
QueryDataSet queryDataSet5 = new QueryDataSet();
XYLayout xYLayout9 = new XYLayout();
TableScrollPane tableScrollPane5 = new TableScrollPane();
JdbTable jdbTable5 = new JdbTable();
JdbNavToolBar jdbNavToolBar5 = new JdbNavToolBar();
JdbStatusLabel jdbStatusLabel5 = new JdbStatusLabel();
JdbLabel jdbLabel6 = new JdbLabel();
JdbTextField jdbTextField6 = new JdbTextField();
XYLayout xYLayout10 = new XYLayout();
JdbLabel jdbLabel7 = new JdbLabel();
JdbTextField jdbTextField7 = new JdbTextField();
JdbLabel jdbLabel8 = new JdbLabel();
JLabel jLabel1 = new JLabel();
public admin_index(Frame owner, String title, boolean modal) {
super(owner, title, modal);
try {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
jbInit();
pack();
} catch (Exception exception) {
exceptionprintStackTrace();
}
}
public admin_index() {
this(new Frame(), "admin_index", false);
}
private void jbInit() throws Exception {
panel1setLayout(borderLayout1);
jTabbedPane1setTabPlacement(JTabbedPaneLEFT);
jTabbedPane1setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel1setLayout(xYLayout1);
jPanel5setBorder(BorderFactorycreateEtchedBorder());
jPanel5setLayout(xYLayout2);
jdbLabel1setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel1setText("用 户 名:");
jdbLabel2setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel2setText("旧 口 令:");
jdbTextField1setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbTextField1setText("");
jdbTextField2setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbTextField2setToolTipText("");
jdbTextField2setText("");
jPanel6setBorder(BorderFactorycreateEtchedBorder());
jPanel6setLayout(xYLayout3);
jButton1setBackground(Colorgray);
jButton1setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jButton1setText("确 认");
jButton1addActionListener(new admin_index_jButton1_actionAdapter(this));
jButton2setBackground(Colorgray);
jButton2setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jButton2setText("取 消");
jdbLabel3setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel3setText("新 口 令:");
jdbLabel4setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel4setText("确认口令:");
jdbTextField3setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbTextField3setText("");
jdbTextField4setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbTextField4setText("");
jPanel2setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel2setLayout(xYLayout4);
database1setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master",
"sa", "lingfeng", false,
"commicrosoftjdbcsqlserverSQLServerDriver"));
queryDataSet1setQuery(new comborlanddxsqldatasetQueryDescriptor(
database1,
"SELECT adminauser 用户名,adminapassword 密码 FROM ADMIN", null, true,
LoadALL));
tableScrollPane1setBorder(BorderFactorycreateEtchedBorder());
jdbTable1setDataSet(queryDataSet1);
jdbStatusLabel1setBorder(BorderFactorycreateEtchedBorder());
jdbStatusLabel1setText("jdbStatusLabel1");
jdbStatusLabel1setDataSet(queryDataSet1);
jdbNavToolBar1setBorder(BorderFactorycreateEtchedBorder());
jdbNavToolBar1setToolTipText("");
jdbNavToolBar1setDataSet(queryDataSet1);
jPanel3setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel3setLayout(xYLayout5);
jPanel8setBorder(BorderFactorycreateEtchedBorder());
jPanel8setLayout(xYLayout10);
database2setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master",
"sa", "lingfeng", false,
"commicrosoftjdbcsqlserverSQLServerDriver"));
tableScrollPane2setBorder(BorderFactorycreateEtchedBorder());
jdbTable2setDataSet(queryDataSet2);
jdbNavToolBar2setDataSet(queryDataSet2);
jdbStatusLabel2setText("jdbStatusLabel2");
jdbStatusLabel2setDataSet(queryDataSet2);
jPanel4setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel4setLayout(xYLayout6);
database3setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master",
"sa", "lingfeng", false,
"commicrosoftjdbcsqlserverSQLServerDriver"));
queryDataSet3setQuery(new comborlanddxsqldatasetQueryDescriptor(
database3,
"select coursecname 课程名,coursecno 课程号,coursecteacher 任课教师,courseccredat " +
"学分,count(scsno) 选课人数 from course,sc where \nsccno=coursecno group " +
"by coursecname,coursecno,coursecteacher,courseccredat", null, true,
LoadALL));
tableScrollPane3setBorder(BorderFactorycreateEtchedBorder());
jdbTable3setDataSet(queryDataSet3);
jdbStatusLabel3setText("jdbStatusLabel3");
jdbStatusLabel3setDataSet(queryDataSet3);
jPanel10setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel10setLayout(xYLayout7);
jPanel12setBorder(BorderFactorycreateEtchedBorder());
jPanel12setLayout(xYLayout8);
jdbLabel5setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel5setText("请输入学生学号:");
database4setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master",
"sa", "lingfeng", false,
"commicrosoftjdbcsqlserverSQLServerDriver"));
queryDataSet4setQuery(new comborlanddxsqldatasetQueryDescriptor(
database4,
"select studentsno 学号,studentsname 姓名,coursecname 课程名,courseccredat " +
"学分,scsgrade 分数 from sc,course,student where scsno=studentsno and " +
"sccno=coursecno", null, true, LoadALL));
tableScrollPane4setBorder(BorderFactorycreateEtchedBorder());
jdbTable4setDataSet(queryDataSet4);
jdbStatusLabel4setText("jdbStatusLabel4");
jdbTextField5setText("");
jdbTextField5addKeyListener(new admin_index_jdbTextField5_keyAdapter(this));
jdbTextField5addActionListener(new
admin_index_jdbTextField5_actionAdapter(this));
jPanel11setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jPanel11setLayout(xYLayout9);
database5setConnection(new ConnectionDescriptor(
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=master",
"sa", "lingfeng", false,
"commicrosoftjdbcsqlserverSQLServerDriver"));
queryDataSet5setQuery(new comborlanddxsqldatasetQueryDescriptor(
database5,
"SELECT studentsno 学号,studentsname 姓名,studentssex 性别,studentsmingzu " +
"民族,studentszhuanye 政治面貌,studentsgrade 年级,studentsxueyuan 学院,studentsclass " +
"班级,studentsphone 电话,studentszhengzhi 政治面貌,studentscard 身份z,studentsaddress " +
"家庭住址,studentsbrith 出生日期,studentsemail 邮箱 FROM masterdbostudent", null, true,
LoadALL));
tableScrollPane5setBorder(BorderFactorycreateEtchedBorder());
jdbTable5setDataSet(queryDataSet5);
jdbStatusLabel5setText("jdbStatusLabel5");
jdbNavToolBar5setBorder(BorderFactorycreateEtchedBorder());
jdbNavToolBar5setDataSet(queryDataSet5);
jdbLabel6setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel6setText("新用户名:");
jdbLabel7setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel7setText("请输入教师号:");
jdbLabel8setFont(new javaawtFont("DialogInput", FontPLAIN, 12));
jdbLabel8setText("例如:2001");
It also offers a buttoned up fastening feature just to increase that extra check out your super additional high quality and exquisiteThe Louboutin Supra Fifre Boots is also studded with Gold tonal buttons,which can be adequate sufficient to stop your options associated with preference to the particular productA 45 " stiletto heel in conjunction with red sole made exclusively by Signature adds beautifies it more gracefullySince the strategy is manufactured in Italy,high quality and precision comes guaranteedAs well as the dust bags and Louboutin replica box causes it to be safer,secured and cleanWith growing demand of the product at a cost much cheaper compared to the original 1,the need for these Christian Louboutin replica boots has risen to a degree
Without the right conditioning and care,leather can dry up until it eventually cracks and falls apart,Discount Christian Louboutin Shoes,and you will probably no more wish to wear them out of the house even if they did cost you a lot of money
Collection with fish head of black colou Christian Louboutinuk shoes,is apparently a minimalist style,Christian Louboutin Ankle Boots,a really brightEye catching dark wine Louboutin high heeled shoes for your easyA pure black dress,due to crimson colored heels by attractive publicityAble waist windbreaker with some traces of the uniform,high heeled shoes using the lace sheepskin boots,walking special
The red soled shoes of louboutin shoes almost end up being the most In power flow single product this coming yearNearly in each and every party and medal presentation,some stars will choose it when waking about the red carpet which makes Christian Louboutin become the symbol of the very most stylish high heel pumpsPick Most Amazing christian louboutin boots for Yourself!
Louboutin is really a native born ParisianHe liked designing varied sketch maps of shoes and he began to do practice following Charles Jourdan inside the seventiesFollowing 10 years'working for Chanel and Yves Saint Laurent,Christian Louboutin setup the first Christian Louboutin shoes store in 1992,starting his careerLet's Select Most Amazing christian louboutin uk for the Dear Mommyit is undeniable a very feminine,not only in shape,but in addition in its vibrant red christian louboutin This may be built to wear a frivolous motives however,in the prudence and elegant wayUnless you intend to make a striking look,Christian Louboutin Peep Toe,wearing that hope is subversive,and let others with the pairs of shockThis really is indeed a classic,you should use any seasonThis can be a black luxury suede and leather with gold design,specifics of the complete pipeline interleaving styleLayered tube a definite toe,while the other will be the whole foot round the heel back to fixedThere is also a foot keyhole detail,this is the completing more holes on the one hand and open toesSelf-heel measures include about 5 inches high,plus some 1 inch hidden platform,Christian Louboutin Evenings,you can find signature red soles
Simple style pink and purple dress with red shoulder and the exact same easy black Louboutin high heeled shoes,yet lively temperament ladiesWhite lace pattern,having a lattice pattern with the fish head shoes,Christian Louboutin Heels,elegant dream
方法/步骤:
1
首先在vfp中调用某方法,应该这样写:do sdl11 in abc
2
而abcprg中是存储过程的,如:proce sdl11
3
租赁单价的新建do sdl25use \dbf\kcwzcbjcopy s
4
租赁单价的添加租赁单价的添加,原有的租赁单位已经存在租赁价格库,但是中途
以上就是关于VFP的主程序如何编写全部的内容,包括:VFP的主程序如何编写、vfp项目如何编译成可执行的应用程序、帮忙做一个小型vfp程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)