Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

2ÖÖÁ¬½ÓÊý¾Ý¿âºÍ¶ÁÈ¡sqlÎļþÌí¼ÓÊý¾Ý¿âºÍ±í

import java.io.*;
import java.sql.*;
public class DBConn {
 private String ADDRESS ;
 private int PORT ;
 private String DBNAME ;
 private String USERNAME ;
 private String PASSWORD ;
 private Connection conn ;
 private PreparedStatement pstmt ;
 private Statement stmt ;
 private ResultSet rs ;
 
 
 /***
  * Á¬½ÓMYSQLÊý¾Ý¿â
  * @return
  */
 public Connection getMySqlConn(){
  try{
   ADDRESS = "127.0.0.1";
   PORT = 3306;
   DBNAME = "test";
   USERNAME = "root";
   PASSWORD = "123456";
   if(conn==null){
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://"+ADDRESS+":"+PORT+"?user="+USERNAME+"&password="+PASSWORD+"&useUnicode=true&characterEncoding=utf8");
   }
  }catch(Exception e){
   e.printStackTrace();
  }
  return conn;
 }
 
 
 /***
  * Á¬½ÓMSSQLÊý¾Ý¿â
  * @return
  */
 public Connection getMSSqlConn(){
  try{
   
   ADDRESS = "127.0.0.1";
   PORT = 1433;
   DBNAME = "mytest";
   USERNAME = "sa";
   PASSWORD = "";
   
   if(conn==null){
    Class.forName("net.sourceforge.jtds.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:jtds:sqlserver://"+ADDRESS+":"+PORT,USERNAME,PASSWORD);
   }
  }catch(Exception e){
   e.printStackTrace();
  }
  return conn;
 }
 
 /**
  * ¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
  * @return
  */
 public void closeConn(){
  try{
   


Ïà¹ØÎĵµ£º

SQL SERVERÖн»ºÍ²îµÄʵÏÖ

create table aaa
(
id int primary key ,
name varchar(30) not null
)
create table bbb
(
id int primary key ,
name varchar(30) not null
)
--½»
select * from aaa
where exists
(
select * from bbb where aaa.id=bbb.id and aaa.name = bbb.name
)
--²î
select *
from bbb
where not exists
( ......

³¹µ×Çå³ýSQL SERVERÊý¾Ý¿â

ÔÚ¸ø¸÷ºÏ×÷ѧУ°²×°Ó¦ÓÃϵͳ¹ý³ÌÖУ¬·¢ÏÖѧУÀïµÄSQL SERVER 2000Êý¾Ý¿âËð»µÁËÖØ×°ºó¶¼·¢ÉúÁËͬÑùµÄÎÊÌ⣬ÄǾÍÊÇ°²×°SQL SERVERÊý¾Ý¿â²»³É¹¦¡£Ô­Òò£º¼´Ê¹Äãͨ¹ý¿ØÖÆÃæ°åÀïµÄ“Ìí¼Ó/ɾ³ý³ÌÐò” Õý³£µÄжÔØSQL SERVERÊý¾Ý¿â£¬µ«ÊÇ£¬SQL SERVER»¹ÊÇûÓÐÍêȫжÔظɾ»£¬»¹ÐèÒªÊÖ¹¤½øÐÐһЩ²Ù×÷¡£Òò´ËÖØа²×°²»³É¹¦£¬º ......

sqlÊý¾Ý¿â±¸·Ý

sql serverÊý¾Ý¿â±¸·Ý·½°¸
2008-08-05 13:15
SQL Server Êý¾Ý¿â±¸·Ý·½°¸
ΪÁ˱£Ö¤SQL Server Êý¾ÝµÄ°²È«£¬Êý¾Ý¿â¹ÜÀíÔ±Ó¦¶¨ÆÚ±¸·ÝÊý¾Ý¿â£¬ÔÚ²»Í¬Çé¿öÏÂÓ¦²ÉÓò»Í¬±¸·ÝÊý¾Ý¿â±¸·Ý²ßÂÔ£¬Ò»·½Ãæά³ÖÊý¾ÝµÄ°²È«ÐÔ£¬ÁíÒ»·½ÃæÒ²¿É±£³ÖSQL Server ÄÜ˳³©ÔËÐС£¾¡×î´óµÄŬÁ¦¼õÉÙÓÉÓÚÊý¾ÝµÄË𻵶Կͻ§Ôì³ÉµÄËðʧ¡£
¸ÅÄî
1) ±¸·Ý ......

linq to sql ÖеÄin ²Ù×÷ʵÏÖ


        string s = " 80,81,83,82";
        string[] s1 = s.Split(',');
        int[] p = new int[s1.Count()];
        for (int i = 0; i < s1.Count( ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ