日期:2014-05-20  浏览次数:20724 次

连结数据库错误
问题在后面的那个数据库连结的地方try....catch...中

/*程序目标:
*   Applet,
*   网页中加入本程序 <applet> </applet> ,显示企业的名片信息
*   参考名片形式:http://show.namepic.com/
*  
*   过程:
*   1、获取页面的参数?userid
*   2、根据参数userid获取数据中的会员资料
*   3、绘图做出名片,显示提取的数据  
*   */
import   java.lang.*;
import   java.awt.*;

import   java.sql.*;
import   java.applet.*;

public   class   company_user_ecard   extends   Applet{
//声明一些属性
FontMetrics   FM;
Color   C,ColorBackground,NomalTextColor;
Font   F,NomalTextFont;
int   Ascent,Descent;
int   AppletWidth,AppletHeight;

String   Str   ;
int   StrWidth;
int   PosiX,PosiY,PosiX2,PosiY2;

String   UserID;
String[]   UserInfos;


//初始化工作,定义背景颜色/通用文字的字体、颜色
public   void   init(){
            ColorBackground   =   Color.BLACK;//enumc
            NomalTextColor   =         Color.WHITE;
            NomalTextFont   =   new   Font( "Courier ",Font.BOLD,24);
            AppletWidth   =         getSize().width;
            AppletHeight   =   getSize().height;
   
          //获取网页参数:用String,不考虑网页userid=   10   ||   a   ;
            UserID   =   getParameter( "userid ");
            //System.out.print(UserID);
            //return;
      }

public   void   paint(Graphics   g){
            //AppletWidth   =         getSize().width;
            //AppletHeight   =   getSize().height;
            setNomalBackRect(g);
   
   
      UserInfos   =   getUserInfo(UserID);
            //txtCompanyName   =   String.valueOf(getUserInfo(UserID));
            //String   txtCompanyName   =   (String)   String.valueOf(getUserInfo(UserID));  
            ///int是原始数据类型   String是对象,所以要对原始数据对象化   //Mr.常   00:56:50


      System.out.print(UserInfos[0]);
      }

public   void   setNomalBackRect(Graphics   g){

            //背景   白色
            setBackground(Color.WHITE);
            //绘制边框
            //第一个框   黑色
            g.setColor(Color.black);
            PosiX   =   2;
            PosiY   =   2;
            PosiX2   =   AppletWidth-2*PosiX;
            PosiY2   =   AppletHeight-2*PosiY;
            g.fillRect(PosiX,PosiY,PosiX2,PosiY2);