JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,Oracle
import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
public static void main(String[] args)throws Exception {
Connection conn=null;
//====Á¬½ÓACCESSÊý¾Ý¿â====
//Á¬½ÓACCESS(·ÇODBCÁ¬½Óģʽ)
//String dbURL ="jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=f:/db1.mdb";
//Á¬½ÓACCESS(ODBC -ϵͳDSNÁ¬½Óģʽ)
//String dbURL="jdbc:odbc:odbcName";
//conn = DriverManager.getConnection(dbURL);//´´½¨Á¬½Ó¶ÔÏó
//System.out.println("ACCESSÊý¾Ý¿âÁ¬½Ó³É¹¦£¡");
//====Á¬½ÓSQLÊý¾Ý¿â====
/*
* String dbURL="jdbc:microsoft:sqlserver://localhost:Êý¾Ý¿â¶Ë¿Ú;DatabaseName=Êý¾Ý¿âÃû";
*
* */
//String dbURL="jdbc:microsoft:sqlserver://localhost:7788;DatabaseName=msdb";
//String userName = "sa";
//String userPwd = "admin";
//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");//¼ÓÔØÇý¶¯
//conn = DriverManager.getConnection(dbURL,userName,userPwd);//´´½¨Á¬½Ó¶ÔÏó
//System.out.println("SQLÊý¾Ý¿âÁ¬½Ó³É¹¦£¡");
//====Á¬½ÓMySQlÊý¾Ý¿â====
/*
* "jdbc:mysql://localhost/Êý¾Ý¿âÃû×Ö?user=Óû§Ãû&password=ÃÜÂë&useUnicode=true&characterEncoding=gb2312";
*
* */
//String dbURL="jdbc:mysql://localhost/hackwang?user=root&password=hackwang&useUnicode=true&characterEncoding=gb2312";
//Class.forName("org.gjt.mm.mysql.Driver");//¼ÓÔØÇý¶¯
//conn = DriverManager.getConnection(dbURL);//´´½¨Á¬½Ó¶ÔÏó
//System.out.printl
Ïà¹ØÎĵµ£º
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......
Ç°ÌâÊDZØÐë°²×°ºÃactiveperl £¨505ÒÔÉÏ£©£¬ÒÔ¼°MS Access 97
¡¡¡¡
¡¡¡¡Ò».
°²×°Win32-ODBCÄ£¿é
¡¡¡¡²½Öè1£º
¡¡¡¡´ÓTOOLSÀ¸Ä¿ÖÐÏÂÔØWin32-ODBC.zip,ÏÂÔØÍêºóÓÃwinzip½â¿ªµ½Ò»¸ötempĿ¼,¹²ÓÐÈý¸öÎļþ£º
¡¡¡¡Readme
¡¡¡¡Win32-ODBC.ppd
¡¡¡¡Win32-ODBC.tar.gz
¡¡¡¡²½Öè2£º
¡¡¡¡ÔÚDOS´°¿ÚÏ£¬tempĿ¼ÖÐÔËÐÐÏÂÃæµÄD ......
Ê×Ò³£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
ÈçºÎÔÚ Access ÖвåÈëÒ»ÌõеļǼʱ,Ô¤ÏÈÖªµÀËûµÄ×Ô¶¯±àºÅIDÄØ?
Õâ¸öÎÊÌâÀ§ÈÅÁËÎҺܾÃ
ºóÀ´ÎÒÏëÁËÒ»¸öºÜ±¿°ì·¨
¾ÍÊÇÏȲåÈëÒ»Ìõ ËæÒâµÄÊý¾Ý µ±È»ÀïÃæÓÐÓÐÒ»¸öÄãʵÏÖÔ¤¶¨ºÃµÄ±êʶ
±ÈÈç
insert into cmd (classID,cmdType,cmd) values('temp','temp','temp')
È»ºóÕÒµ½Ëü ¶ÁÈ¡ËüµÄID
select * from cmd where classID ......
//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//Êý¾Ý¿âµØÖ·
private string datapatch = "db/global.asa";//Êý¾Ý¿âµØÖ·
///
/// È¡µÃdataset
//
/// ²éѯÓï¾ä
///
public DataSet GetDataSet(string Commandtext)
{&nbs ......