java操作mssql2000的小例子

王朝mssql·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

主要由三个文件组成.一个是主执行文件,一个是用户界面文件,一个是数据模块文件.

用户界面这一块是用的eclipse的VE插件做的,只是还不知道如何发布这样的应用程序.唉...

//主程序

package com.fcgl;

public class FC {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

Login.main(null);

}

}

//用户界面

package com.fcgl;

import Java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import org.eclipse.swt.SWT;

import org.eclipse.swt.graphics.Point;

import org.eclipse.swt.graphics.Rectangle;

import org.eclipse.swt.layout.FillLayout;

import org.eclipse.swt.widgets.Button;

import org.eclipse.swt.widgets.Composite;

import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.widgets.Label;

import org.eclipse.swt.widgets.List;

import org.eclipse.swt.widgets.Shell;

import org.eclipse.swt.widgets.Text;

public class Login {

private Shell sShell = null; // @jve:decl-index=0:visual-constraint="74,10"

private Composite composite1 = null;

private Button button1 = null;

private Dm dm1;

private Label label1 = null;

private Text text1 = null;

private Text text2 = null;

private Text text3 = null;

private Text textArea1 = null;

private List list1 = null;

private Button button2 = null;

/**

* This method initializes composite1

*

*/

private void createComposite1() {

composite1 = new Composite(sShell, SWT.NONE);

composite1.setLayout(null);

button1 = new Button(composite1, SWT.NONE);

button1.setText("连接");

button1.setSize(new Point(48, 22));

button1.setLocation(new Point(176, 159));

button1.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter()

{

public void widgetSelected(org.eclipse.swt.events.SelectionEvent e)

{

dm1 = new Dm();

boolean c = dm1.DconnectionOpen(text1.getText

(),text2.getText(),text3.getText());

if (button1.getText() == "连接") {

if (c == false) {

label1.setText("连接失败");

} else {

label1.setText("连接成功");

button1.setText("断开");

ResultSet rs=dm1.ExeSQL(textArea1.getText

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航