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

java³ÌÐòÁ¬½ÓSQlServerµÄÎÊÌâ - Java / Java SE

import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class QueryTest 
{
private Connection con;

public static void main(String [] atgs)
{
QueryTest test = new QueryTest();
Connection con = test.getConnection();
String sql = "select * from Student";
test.getStudent(con, sql);

}
public void getStudent(Connection con, String sql)
{
try 
{
Statement st = con.createStatement(); //ÉêÇë»á»°
ResultSet rs = st.executeQuery(sql); //»ñµÃ²éѯ¼Ç¼¼¯
while( rs.next() )
{
String name = rs.getString( "ÐÕÃû" );
String number = rs.getString( "ѧºÅ" );
String sex = rs.getString( "ÐÔ±ð" );
Date date = rs.getDate( "ÉúÈÕ" );
String spe = rs.getString( "רҵ" );
String address = rs.getString( "¼®¹á" );

System.out.println( "\nÐÕÃû£º " + name + "\tѧºÅ" + number + "\tÐÔ±ð" + sex 
+ "\tÉúÈÕ" + date + "\tרҵ" + spe + "\t¼®¹á" + address );
}
st.close();
con.close();
}
catch( SQLException e )
{


Ïà¹ØÎÊ´ð£º

java appletÔÚhtmlÖÐÎÞ·¨ÏÔʾ

ÎÒµÄjava applet ǶÈëhtmlºóÎÞ·¨ÏÔʾ£¬¶øÓÃappletviewerÏÔʾÕý³£ÎªÊ²Ã´£¬»¹ÓоÍÊÇÓÃhtml converterת»¯ºó¿ÉÒÔÏÔʾ£¬ÎªÊ²Ã´£¿Çë´óÏÀ´Í½Ì£¡
HTML code:

<HTML>
<HEAD>
<TITLE>TEST.HTML< ......

ÕÐƸȫְ¡¢¼æÖ°JAVA¿ª·¢¹¤³Ì

´ó¼ÒºÃ£¬ÎÒÃǽüÆÚÕÐƸȫְ¡¢¼æÖ°¿ª·¢¹¤³Ìʦ£¬È«Ö°¹¤³Ìʦ¹¤×÷µØµãÖ÷ÒªÊÇÉîÛÚ£¬¼æÖ°¹¤³Ìʦ±¾ÈË¿ÉÔÚÉîÛÚ£¬Ò²¿ÉÒÔÔÚÒìµØͨ¹ýÔ¶³ÌЭͬ¿ª·¢µÄ·½Ê½¿ªÕ¹¹¤×÷£¬ºÏ×÷·½Ê½¿É¹²Í¬É̶¨¡£


ְλE601£ºJava ¹¤³Ìʦ£¨Web ¿ ......

ÔõôÓÃJavaʵÏÖ¶¨Ê±Ö´ÐÐij³ÌÐò - Java / Java SE

ÎÒÏëÓÃJavaдһ¸ö³ÌÐò£¬¾ÍÊÇÎÒÏëÔÚÔËÐдúÂëºó£¬ÔÚÖ¸¶¨µÄʱ¼ä´ò¿ªÄ³³ÌÐò£¬ÀýÈçÎÒÔËÐдúÂëºó£¬½²ÔÚ12£º00´ò¿ª"D:\Program Files\Tencent\QQ2009\Bin\QQ.exe"Õâ¸ö³ÌÐò£¬Çó¸ßÈËÖ¸µã¡£»¹ÓпÉÄܵĻ°ÔÚÖ¸¶¨µÄʱ¼ä ......

javaµÄСÎÊÌâ extends

public   class   Student{

//×ֶεĶ¨Òå
private   String   _number;   //ѧºÅ
private   String   _name;       //ÐÕÃû
private   ......

Çó½Ì ²é¿´SqlServerÖ´ÐйýµÄ´æ´¢¹ý³Ì״̬

ÔÚSqlServerÖÐÈçºÎ²é¿´ÀúÊ·ÉÏÖ´ÐеĴ洢¹ý³ÌµÄÐÅÏ¢ÄØ£¬È磺´«Èë²ÎÊý£¬Ö´ÐÐʱ¼äµÈµÈ¡£Èç¹û²»Äܲ鿴ÀúÊ·¼Ç¼£¬ÊÇ·ñ¿ÉÒÔ×Ô¼ºÐ´´¥·¢Æ÷Ö®ÀàµÄ£¬È˹¤¿ØÖÆÄØ£¬ÔÚOracleÀïÃæÓж¯Ì¬ÊÓͼ¿ÉÒÔËæʱ²é¿´ÀúÊ·Ö´ÐеÄsqlÓï¾ä£¬SqlSer ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ