java操作mssql2000的小例子
2008-01-05 17:57:45 来源:WEB开发网核心提示: 主要由三个文件组成.一个是主执行文件,一个是用户界面文件,一个是数据模块文件.用户界面这一块是用的eclipse的VE插件做的,只是还不知道如何发布这样的应用程序.唉... //主程序package com.fcgl;public class FC { /** * @para
主要由三个文件组成.一个是主执行文件,一个是用户界面文件,一个是数据模块文件. 用户界面这一块是用的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
更多精彩
赞助商链接