<hibernate-configuration>
??? <session-factory>
??????? <!-- Database connection settings -->
??????? <property? name="connection.datasource">java:comp/env/jdbc/PathPlat</property>?
??????? <!-- SQL dialect -->
??????? <!--<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>-->
??????? <property name="dialect">org.hibernate.dialect.OracleDialect</property>
??????? <!-- Enable Hibernate's automatic session context management -->
??????? <property name="current_session_context_class">thread</property>
??????? <!-- Disable the second-level cache? -->
??????? <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
??????? <!-- Echo all executed SQL to stdout -->
??????? <property name="show_sql">false</property>
?<mapping resource="/wms/entity/WmsAdjustStoreCmdt.hbm.xml"/>
??????? <mapping resource="/wms/entity/WmsStorage.hbm.xml"/>
??
??? </session-factory>
</hibernate-configuration>
posted @
2007-08-15 10:44 華夢(mèng)行 閱讀(150) |
評(píng)論 (0) |
編輯 收藏
豎排格式:Portrait? 橫排格式:landscape
posted @
2007-08-14 19:18 華夢(mèng)行 閱讀(151) |
評(píng)論 (0) |
編輯 收藏
?If dtmDateLowerLimit is not null and dtmDateUpperLimit is not null then
??? temps := temps ||' AND DATEDIFF(''d'', to_date('''||to_char(dtmDateLowerLimit,'yyyy-mm-dd ')|| ' 00:00:00'||''',''yyyy-mm-dd HH24:mi:ss''), a.SendTime) >= 0 AND DATEDIFF(''d'', a.SendTime, to_date('''||to_char(dtmDateUpperLimit,'yyyy-mm-dd')|| ' 23:59:59'||''',''yyyy-mm-dd HH24:mi:ss'')) >= 0 ' ;
? End If;?
posted @
2007-08-13 11:14 華夢(mèng)行 閱讀(86) |
評(píng)論 (0) |
編輯 收藏
document.getElementById("ffff").readOnly=true;
?readOnly? O必須大寫
posted @
2007-08-10 14:20 華夢(mèng)行 閱讀(127) |
評(píng)論 (0) |
編輯 收藏
? Session session = HibernateUtil.getSession();
??????????? Criteria crit = session.createCriteria(entityClass);
??????????? crit.add(Restrictions.eq("orgTypeId", orgId));?
??????????? crit.add(Restrictions.eq("StructID", strTypeid));
??????????? List entities = crit.list();
??????????? populate(sheet, entities);
? Hibernate 條件查詢
/*
?* ExportManager.java
?*
?* Created on 2006年7月30日, 下午2:40
?*
?* To change this template, choose Tools | Template Manager
?* and open the template in the editor.
?*/
package path.system.manager;
import java.io.*;
import java.util.List;
import java.util.Date;
import java.sql.Timestamp;
import java.lang.reflect.*;
import java.math.BigDecimal;
import jxl.*;
import jxl.write.*;
import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import path.system.manager.HibernateUtil;
import path.util.DoNumber;
/**
?*
?* @author zhaoming
?*/
public class ExportManager {
???
??? private Class entityClass;
??? private Field[] fields;
??? private Class[] fieldTypes;
???
??? private static WritableCellFormat integerFormat = new WritableCellFormat(NumberFormats.INTEGER);
??? private static WritableCellFormat floatFormat = new WritableCellFormat(new NumberFormat("#.####"));
??? private static WritableCellFormat dateFormat = new WritableCellFormat(new DateFormat("yyyy-MM-dd"));
???
??? public ExportManager() {
??? }
???
??? /**
???? * 輸出excel
???? * @param is 原始excel模版輸入流
???? * @param os 目的輸出流,這里是ServletOutputStream
???? */
??? public void exportExcel(InputStream is, OutputStream os, String orgId) {
??????? WritableWorkbook wb = null;
??????? try {
??????????? wb = Workbook.createWorkbook(os, Workbook.getWorkbook(is));
??????????? WritableSheet sheet = wb.getSheet(0);
??????????? init(sheet);
??????????? Session session = HibernateUtil.getSession();
??????????? Criteria crit = session.createCriteria(entityClass);
??????????? crit.add(Restrictions.eq("orgTypeId", orgId));
??????????? List entities = crit.list();
??????????? populate(sheet, entities);
??????????? wb.write();
??????? } catch (Exception e) {
??????????? e.printStackTrace();
??????? } finally {
??????????? try { wb.close(); } catch (Exception e) {}
??????? }
??? }
??? public void exportExcelCd(InputStream is, OutputStream os, String orgId, String strTypeid) {
??????? WritableWorkbook wb = null;
??????? try {
??????????? wb = Workbook.createWorkbook(os, Workbook.getWorkbook(is));
??????????? WritableSheet sheet = wb.getSheet(0);
??????????? init(sheet);
??????????? Session session = HibernateUtil.getSession();
??????????? Criteria crit = session.createCriteria(entityClass);
??????????? crit.add(Restrictions.eq("orgTypeId", orgId));?
??????????? crit.add(Restrictions.eq("StructID", strTypeid));
??????????? List entities = crit.list();
??????????? populate(sheet, entities);
??????????? wb.write();
??????? } catch (Exception e) {
??????????? e.printStackTrace();
??????? } finally {
??????????? try { wb.close(); } catch (Exception e) {}
??????? }
??? }
???
??? private void init(WritableSheet sheet) throws Exception {
??????? entityClass = Class.forName(sheet.getCell(0, 0).getContents().trim());
??????? Cell[] fieldNames = sheet.getRow(1);
??????? int len = fieldNames.length;
??????? fields = new Field[len];
??????? fieldTypes = new Class[len];
??????? for (int i = 0; i < len; i++) {
??????????? fields[i] = entityClass.getDeclaredField(fieldNames[i].getContents().trim());
??????????? fieldTypes[i] = fields[i].getType();
??????? }
??? }
???
??? private void populate(WritableSheet sheet, List entities) throws Exception {
??????? for (int i = 0; i < entities.size(); i++) {
??????????? Object entity = entities.get(i);
??????????? for (int j = 0; j < fields.length; j++) {
??????????????? fields[j].setAccessible(true);
??????????????? WritableCell cell = getCell(i + 3, j, fields[j].get(entity));
??????????????? sheet.addCell(cell);
??????????? }
??????? }
??? }
???
??? private WritableCell getCell(int row, int col, Object value) {
??????? if (fieldTypes[col] == String.class)
??????????? return new Label(col, row, (String) value);
??????? if (fieldTypes[col] == long.class || fieldTypes[col] == Long.class)
??????????? return new jxl.write.Number(col, row, value == null ? 0 : ((Long) value).longValue(), integerFormat);
??????? if (fieldTypes[col] == int.class || fieldTypes[col] == Integer.class)
??????????? return new jxl.write.Number(col, row, value == null ? 0 : ((Integer) value).intValue(), integerFormat);
??????? if (fieldTypes[col] == double.class || fieldTypes[col] == Double.class)
??????????? return new jxl.write.Number(col, row, value == null ? 0 : ((Double) value).doubleValue(), floatFormat);
??????? if (fieldTypes[col] == float.class || fieldTypes[col] == Float.class)
??????????? return new jxl.write.Number(col, row, value == null ? 0 : ((Float) value).floatValue(), floatFormat);
??????? if (fieldTypes[col] == BigDecimal.class)
??????????? return new jxl.write.Number(col, row, value == null ? 0 : ((BigDecimal) value).doubleValue(), floatFormat);
??????? if (fieldTypes[col] == Timestamp.class || fieldTypes[col] == Date.class)
??????????? return new jxl.write.DateTime(col, row, value == null ? new Date() : (Date) value, dateFormat);
??????? return null;
??? }
???
}
posted @
2007-08-10 14:18 華夢(mèng)行 閱讀(235) |
評(píng)論 (0) |
編輯 收藏
var oOpener = dialogArguments ;
??????
?oOpener.szOldPassword = document.all.OldPassword.value ;
?oOpener.szNewPassword = document.all.NewPassword.value ;
?oOpener.bIsEditPwd = true ;
openDialog('UserModifyPwd.jsp?TimeID=' + Math.random(),window,300,180) ;
?if (bIsEditPwd == true){
??document.Form1.OldPassword.value = szOldPassword ;
??document.Form1.NewPassword.value = szNewPassword ;
??top.topFrame.saveURL('../Configure/UserConfigure.jsp?AutoShow=Yes&TimeID=' + Math.random()) ;
??document.Form1.submit() ;
?}
posted @
2007-08-01 16:26 華夢(mèng)行 閱讀(583) |
評(píng)論 (0) |
編輯 收藏
select * from col , user_tab_cols??
posted @
2007-07-31 11:39 華夢(mèng)行 閱讀(89) |
評(píng)論 (0) |
編輯 收藏
D:\aa>keytool -genkey -v -alias JoeUserKey -keyalg RSA
輸入keystore密碼:? huamengxing
您的名字與姓氏是什么?
? [Unknown]:? Joe usr
您的組織單位名稱是什么?
? [Unknown]:? security
您的組織名稱是什么?
? [Unknown]:? commmm,Inc
您所在的城市或區(qū)域名稱是什么?
? [Unknown]:? fsdfs
您所在的州或省份名稱是什么?
? [Unknown]:? fsdfsd
該單位的兩字母國(guó)家代碼是什么
? [Unknown]:? cn
CN=Joe usr, OU=security, O="commmm,Inc", L=fsdfs, ST=fsdfsd, C=cn 正確嗎?
? [否]:? y
創(chuàng)建1,024比特RSA鍵值對(duì)及針對(duì)CN=Joe usr, OU=security, O="commmm,Inc", L=fsdfs, ST
=fsdfsd, C=cn的自我簽署的認(rèn)證 (MD5WithRSA)
??????? :
輸入<JoeUserKey>的主密碼
??????? (如果和 keystore 密碼相同,按回車):
[正在存儲(chǔ) C:\Documents and Settings\ljl\.keystore]
D:\aa>keytool -list -v -genkey -alias JooUserKey
輸入keystore密碼:? huamengxing
您的名字與姓氏是什么?
? [Unknown]:? Joe usr
您的組織單位名稱是什么?
? [Unknown]:? security
您的組織名稱是什么?
? [Unknown]:? commmm,Inc
您所在的城市或區(qū)域名稱是什么?
? [Unknown]:? fadfs
您所在的州或省份名稱是什么?
? [Unknown]:? fsdfsd
該單位的兩字母國(guó)家代碼是什么
? [Unknown]:? cn
CN=Joe usr, OU=security, O="commmm,Inc", L=fadfs, ST=fsdfsd, C=cn 正確嗎?
? [否]:? y
創(chuàng)建1,024比特DSA鍵值對(duì)及針對(duì)CN=Joe usr, OU=security, O="commmm,Inc", L=fadfs, ST
=fsdfsd, C=cn的自我簽署的認(rèn)證 (SHA1WithDSA)
??????? :
輸入<JooUserKey>的主密碼
??????? (如果和 keystore 密碼相同,按回車):
[正在存儲(chǔ) C:\Documents and Settings\ljl\.keystore]
D:\aa>keytool -list -v? -alias JooUserKey
輸入keystore密碼:? huamengxing
別名名稱: JooUserKey
創(chuàng)建日期: 2007-7-30
輸入類型:KeyEntry
認(rèn)證鏈長(zhǎng)度: 1
認(rèn)證 [1]:
Owner: CN=Joe usr, OU=security, O="commmm,Inc", L=fadfs, ST=fsdfsd, C=cn
發(fā)照者: CN=Joe usr, OU=security, O="commmm,Inc", L=fadfs, ST=fsdfsd, C=cn
序號(hào): 46ad82e0
有效期間: Mon Jul 30 14:19:12 CST 2007 至: Sun Oct 28 14:19:12 CST 2007
認(rèn)證指紋:
???????? MD5:? 88:F5:21:21:2C:65:03:84:60:12:65:55:39:D3:A0:1E
???????? SHA1: 37:B6:87:9F:C4:EA:E4:50:9A:F4:00:B3:41:58:C8:F0:10:5E:44:8E
D:\aa>
D:\>keytool.exe -genkey -alias Tomcat -keyalg RSA -storepass bigsecret -keypass bigsecret -dname "cn=localhost"
執(zhí)行完該命令后,就會(huì)在HOME目錄下生成一個(gè).keystore文件。下面是各種切換命令的含義:
· genkey:告訴keytool應(yīng)用程序生成新的公鑰/私鑰對(duì)。
· alias:用于引用密鑰的名稱。記住,.keystore文件可包含多個(gè)密鑰。
· Keyalg:使用RSA算法生成公鑰/私鑰對(duì)。
· Storepass:訪問(wèn).keystore文件所需的口令。
· Keypass:管理密鑰所需的口令。
· dname:該值非常重要。.我使用了localhost,因?yàn)樵撌纠辉O(shè)計(jì)為本地運(yùn)行。如果一個(gè)Web應(yīng)用程序被注冊(cè)為http://www.myserver.com,那么該值就必須是www.myserver.com。如果名稱不匹配,證書就會(huì)自動(dòng)被拒絕。
一旦keytool應(yīng)用程序創(chuàng)建了一個(gè)新的公鑰/私鑰對(duì),它就自動(dòng)自簽名該密鑰。我們剛剛生成了自己的自簽名證書,它可用于HTTPS通信。只需提取出自簽名公鑰。后面我將展示如何做。
posted @
2007-07-30 14:24 華夢(mèng)行 閱讀(1283) |
評(píng)論 (0) |
編輯 收藏
public void close()
??? {
??????? try
??????? {
???????????? if(rs!=null) rs.close();
???????????? if(st!=null) st.close();
???????????? if(cn!=null) cn.close();
??????? }
??????? catch(SQLException _ex)
??????? {
??????????? try
??????????? {
??????????????? if(rs != null)?? rs.close();
??????????? }
??????????? catch(SQLException _ex2)
??????????? {
??????????????? try
??????????????? {
??????????????????? if(st != null) st.close();
??????????????? }
??????????????? catch(SQLException _ex3) {
??????????????? }
??????????????? try
??????????????? {
??????????????????? if(cn != null) cn.close();
??????????????? }
??????????????? catch(SQLException _ex3) {
??????????????? }
??????????? }
??????????? try
??????????? {
??????????????? if(st != null)? st.close();
??????????? }
??????????? catch(SQLException _ex2)
??????????? {
??????????????? try
??????????????? {
??????????????????? if(cn != null) cn.close();
??????????????? }
??????????????? catch(SQLException _ex3) {
??????????????? }
??????????? }
??????????? try
??????????? {
??????????????? if(cn != null)?? cn.close();
??????????? }
??????????? catch(SQLException _ex2) {
??????????? }
??????? }
??????? finally
??????? {
????????? try
????????? {
?????????? // if(rs!=null) rs.close();
??????????? if(st!=null) st.close();
??????????? if(cn!=null) cn.close();
????????? }
????????? catch(Exception e)
????????? {
??????????? //System.out.println(e.toString());
????????? }
??????? }
??? }
posted @
2007-07-27 13:56 華夢(mèng)行 閱讀(92) |
評(píng)論 (0) |
編輯 收藏
select NVL(b.Name, ' ') AS spec, ' ' as packs,
'' as Quant,
'' as Price,
?NVL(a.feeamount,0) as amount, ' ' as cpbh,' ' as cpname, ' ' as jidw
from ITM_Documentfee a? left join
sys_datadictionary b on b.id=a.feeid????
union
select
NVL(b.Spec, ' ') AS spec,
NVL(b.field1,' ') as packs,
case Quant
?when 0 then
? ' '
?when null then
? ' '
?else
?? to_char(Quant)?
end as Quant
,
case Price
?when 0 then
? ' '
?when null then
? ' '
?else
?? to_char(Price)?
end as Price
,
? NVL(b.Amount, 0) AS amount,
c.SerialNumber as cpbh,NVL(c.EnName, ' ') AS cpname,
NVL(t.Symbol, ' ') AS jidw
from ITM_SalesCommodity b
left join CRM_Commodity c ON c.TypeID = b.CommodityTypeID
LEFT OUTER JOIN????? BSE_MeasureStyle t ON b.QuantUnitID = t.ID
select ISNULL(b.Name, ' ') AS spec, ' ' as packs,
'' as Quant,
'' as Price,
?isnull(a.feeamount,0) as amount, ' ' as cpbh,' ' as cpname, ' ' as jidw
from ITM_Documentfee a? left join
sys_datadictionary b on b.id=a.feeid????
union
select
ISNULL(b.Spec, ' ') AS spec,
isnull(b.field1,' ') as packs,
Quant =
case
?when Quant>0 then
? CAST( Quant AS varchar(20))
?else ''
end
,
Price =
case
?when Price>0 then
? CAST( Price AS varchar(20))
?else ''
end
,
? ISNULL(b.Amount, 0) AS amount,
c.SerialNumber as cpbh,ISNULL(c.EnName, ' ') AS cpname,
ISNULL(t.Symbol, ' ') AS jidw
from ITM_SalesCommodity b
left join CRM_Commodity c ON c.TypeID = b.CommodityTypeID
LEFT OUTER JOIN????? BSE_MeasureStyle t ON b.QuantUnitID = t.ID
posted @
2007-07-27 13:44 華夢(mèng)行 閱讀(100) |
評(píng)論 (0) |
編輯 收藏
using System;
using System.Data;
using System.Data.SqlClient;
namespace com.hua..li
{
?/// <summary>
?/// 數(shù)據(jù)庫(kù)操作
?/// </summary>
?public class pathDB:pathPage
?{
??override protected void OnInit(EventArgs e)
??{
???pathInit();
???base.OnInit(e);
??}
??protected void pathInit()
??{
???this.ConnectDb();
??}
??protected void ConnectDb()
??{
???if(doh == null)
???{
????System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["connString"]);
????doh = new com.path.SqlDbOperHandler(conn);
???}
??}
?}
}
using System;
namespace com.hua.li
?{
??/// <summary>
??/// 表示數(shù)據(jù)庫(kù)連接類型。
??/// </summary>
??public enum DatabaseType:byte{SqlServer,OleDb};
??/// <summary>
??/// DbOperHandler 的摘要說(shuō)明。
??/// </summary>
??public abstract class DbOperHandler
??{
???/// <summary>
???/// 析構(gòu)函數(shù),釋放申請(qǐng)的資源。
???/// </summary>
???~DbOperHandler()
???{
????conn.Close();
???}
???/// <summary>
???/// 表示數(shù)據(jù)庫(kù)連接的類型,目前支持SqlServer和OLEDB
???/// </summary>
???protected DatabaseType dbType=DatabaseType.OleDb;
???/// <summary>
???/// 返回當(dāng)前使用的數(shù)據(jù)庫(kù)連接對(duì)象。
???/// </summary>
???/// <returns></returns>
???public System.Data.IDbConnection GetConnection()
???{
????return conn;
???}
???/// <summary>
???/// 條件表達(dá)式,用于在數(shù)據(jù)庫(kù)操作時(shí)篩選記錄,通常用于僅需指定表名稱和某列名稱的操作,如GetValue(),Delete()等,支持查詢參數(shù),由AddConditionParameters指定。。
???/// </summary>
???public string ConditionExpress=string.Empty;
???/// <summary>
???/// 當(dāng)前的SQL語(yǔ)句。
???/// </summary>
???public string SqlCmd=string.Empty;
???/// <summary>
???/// 當(dāng)前操作所涉及的數(shù)據(jù)表名稱。
???/// </summary>
???protected string tableName=string.Empty;
???/// <summary>
???/// 當(dāng)前操作所設(shè)計(jì)的字段名稱。
???/// </summary>
???protected string fieldName=string.Empty;
???/// <summary>
???/// 當(dāng)前所使用的數(shù)據(jù)庫(kù)連接。
???/// </summary>
???protected System.Data.IDbConnection conn;
???/// <summary>
???/// 當(dāng)前所使用的命令對(duì)象。
???/// </summary>
???protected System.Data.IDbCommand cmd;
???/// <summary>
???/// 當(dāng)前所使用的數(shù)據(jù)庫(kù)適配器。
???/// </summary>
???protected System.Data.IDbDataAdapter da;
??
???/// <summary>
???/// 用于存儲(chǔ)字段/值配對(duì)。
???/// </summary>
???protected System.Collections.ArrayList alFieldItems=new System.Collections.ArrayList(10);
???/// <summary>
???/// 用于存儲(chǔ)SQL語(yǔ)句中的查詢參數(shù)。
???/// </summary>
???protected System.Collections.ArrayList alSqlCmdParameters=new System.Collections.ArrayList(5);
???/// <summary>
???/// 用于存儲(chǔ)條件表達(dá)式中的查詢參數(shù)。
???/// </summary>
???protected System.Collections.ArrayList alConditionParameters=new System.Collections.ArrayList(5);
???/// <summary>
???/// 重值該對(duì)象,使之恢復(fù)到構(gòu)造時(shí)的狀態(tài)。
???/// </summary>
???public void Reset()
???{
????this.alFieldItems.Clear();
????this.alSqlCmdParameters.Clear();
????this.alConditionParameters.Clear();
????this.ConditionExpress=string.Empty;
????this.SqlCmd=string.Empty;
????this.cmd.Parameters.Clear();
????this.cmd.CommandText=string.Empty;
???}
???/// <summary>
???/// 添加一個(gè)字段/值對(duì)到數(shù)組中。
???/// </summary>
???/// <param name="_fieldName">字段名稱。</param>
???/// <param name="_fieldValue">字段值。</param>
???public void AddFieldItem(string _fieldName,object _fieldValue)
???{
????for(int i=0;i<this.alFieldItems.Count;i++)
????{
?????if(((DbKeyItem)this.alFieldItems[i]).fieldName==_fieldName)
?????{
??????throw new ArgumentException("The field name has existed!");
?????}
????}
????this.alFieldItems.Add(new DbKeyItem(_fieldName,_fieldValue));
???}
???/// <summary>
???/// 添加條件表達(dá)式中的查詢參數(shù)到數(shù)組中。注意:當(dāng)數(shù)據(jù)庫(kù)連接為SqlServer時(shí),參數(shù)名稱必須和SQL語(yǔ)句匹配。其它則只需保持添加順序一致,名稱無(wú)需匹配。
???/// </summary>
???/// <param name="_conditionName">條件名稱。</param>
???/// <param name="_conditionValue">條件值。</param>
???public void AddConditionParameter(string _conditionName,object _conditionValue)
???{
????for(int i=0;i<this.alConditionParameters.Count;i++)
????{
?????if(((DbKeyItem)this.alConditionParameters[i]).fieldName==_conditionName)
?????{
??????throw new ArgumentException("The condition name has existed!");
?????}
????}
????this.alConditionParameters.Add(new DbKeyItem(_conditionName,_conditionValue));
???}
???/// <summary>
???/// 添加SQL語(yǔ)句中的查詢參數(shù)到數(shù)組中。注意:當(dāng)數(shù)據(jù)庫(kù)連接為SqlServer時(shí),參數(shù)名稱必須和SQL語(yǔ)句匹配。其它則只需保持添加順序一致,名稱無(wú)需匹配。
???/// </summary>
???/// <param name="_paraName">參數(shù)名稱。</param>
???/// <param name="_paraValue">參數(shù)值。</param>
???public void AddSqlCmdParameters(string _paraName,object _paraValue)
???{
????for(int i=0;i<this.alSqlCmdParameters.Count;i++)
????{
?????if(((DbKeyItem)this.alSqlCmdParameters[i]).fieldName==_paraName)
?????{
??????throw new ArgumentException("The sqlcmd parameter name has existed!");
?????}
????}
????this.alSqlCmdParameters.Add(new DbKeyItem(_paraName,_paraValue));
???}
???public bool Exist(string tableName)
???{
????return this.GetValue(tableName,"count(*)").ToString()!="0";
???}
???/// <summary>
???/// 抽象函數(shù)。用于產(chǎn)生Command對(duì)象所需的參數(shù)。
???/// </summary>
???protected abstract void GenParameters();
???/// <summary>
???/// 根據(jù)當(dāng)前alFieldItem數(shù)組中存儲(chǔ)的字段/值向指定表中添加一條數(shù)據(jù)。在該表無(wú)觸發(fā)器的情況下返回添加數(shù)據(jù)所獲得的自動(dòng)增長(zhǎng)id值。
???/// </summary>
???/// <param name="_tableName">要插入數(shù)據(jù)的表名稱。</param>
???/// <returns>返回本數(shù)據(jù)連接上產(chǎn)生的最后一個(gè)自動(dòng)增長(zhǎng)id值。</returns>
???public int Insert(string _tableName)
???{
???
????this.tableName=_tableName;
????this.fieldName=string.Empty;
????this.SqlCmd="insert into "+this.tableName+"(";
????string tempValues=" values(";
????for(int i=0;i<this.alFieldItems.Count-1;i++)
????{
?????this.SqlCmd+=((DbKeyItem)alFieldItems[i]).fieldName;
?????this.SqlCmd+=",";
?????tempValues+="@para";
?????tempValues+=i.ToString();
?????tempValues+=",";
????}
????this.SqlCmd+=((DbKeyItem)alFieldItems[alFieldItems.Count-1]).fieldName;
????this.SqlCmd+=") ";
????tempValues+="@para";
????tempValues+=(alFieldItems.Count-1).ToString();
????tempValues+=")";
????this.SqlCmd+=tempValues;
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????cmd.ExecuteNonQuery();
????cmd.CommandText="select @@identity as id";
????int autoId=Convert.ToInt32(cmd.ExecuteScalar());
????return autoId;
???}
???/// <summary>
???/// 根據(jù)當(dāng)前alFieldItem數(shù)組中存儲(chǔ)的字段/值和條件表達(dá)式所指定的條件來(lái)更新數(shù)據(jù)庫(kù)中的記錄,返回所影響的行數(shù)。
???/// </summary>
???/// <param name="_tableName">要更新的數(shù)據(jù)表名稱。</param>
???/// <returns>返回此次操作所影響的數(shù)據(jù)行數(shù)。</returns>
???public int Update(string _tableName)
???{
????this.tableName=_tableName;
????this.fieldName=string.Empty;
????this.SqlCmd="update "+this.tableName+" set ";
????for(int i=0;i<this.alFieldItems.Count-1;i++)
????{
?????this.SqlCmd+=((DbKeyItem)alFieldItems[i]).fieldName;
?????this.SqlCmd+="=";
?????this.SqlCmd+="@para";
?????this.SqlCmd+=i.ToString();
?????this.SqlCmd+=",";
????}
????this.SqlCmd+=((DbKeyItem)alFieldItems[alFieldItems.Count-1]).fieldName;
????this.SqlCmd+="=";
????this.SqlCmd+="@para";
????this.SqlCmd+=(alFieldItems.Count-1).ToString();
????if(this.ConditionExpress!=string.Empty)
????{
?????this.SqlCmd=this.SqlCmd+" where "+this.ConditionExpress;
????}
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????int effectedLines=this.cmd.ExecuteNonQuery();
????return effectedLines;
???}
???/// <summary>
???/// 執(zhí)行SqlCmd中的SQL語(yǔ)句,參數(shù)由AddSqlCmdParameters指定,與ConditionExpress無(wú)關(guān)。
???/// </summary>
???/// <returns>返回此次操作所影響的數(shù)據(jù)行數(shù)。</returns>
???public int ExecuteSqlNonQuery()
???{
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????return cmd.ExecuteNonQuery();
???}
???/// <summary>
???/// 獲取指定表,指定列,指定條件的第一個(gè)符合條件的值。
???/// </summary>
???/// <param name="_tableName">表名稱。</param>
???/// <param name="_fieldName">字段名稱。</param>
???/// <returns>獲取的值。如果為空則返回null。</returns>
???public object GetValue(string _tableName,string _fieldName)
???{
????this.tableName=_tableName;
????this.fieldName=_fieldName;
????this.SqlCmd="select "+this.fieldName+" from "+this.tableName;
????if(this.ConditionExpress!=string.Empty)
????{
?????this.SqlCmd=this.SqlCmd+" where "+this.ConditionExpress;
????}
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????return cmd.ExecuteScalar();
???}
???/// <summary>
???/// 根據(jù)當(dāng)前指定的SqlCmd獲取DataTable。如果ConditionExpress不為空則會(huì)將其清空,所以條件表達(dá)式需要包含在SqlCmd中。
???/// </summary>
???/// <returns>返回查詢結(jié)果DataTable。</returns>
???public System.Data.DataTable GetDataTable()
???{
????System.Data.DataSet ds=this.GetDataSet();
????return ds.Tables[0];
???}
???/// <summary>
???/// 根據(jù)當(dāng)前指定的SqlCmd獲取DataSet。如果ConditionExpress不為空則會(huì)將其清空,所以條件表達(dá)式需要包含在SqlCmd中。
???/// </summary>
???/// <returns>返回查詢結(jié)果DataSet。</returns>
???public System.Data.DataSet GetDataSet()
???{
????this.alConditionParameters.Clear();
????this.ConditionExpress=string.Empty;
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????System.Data.DataSet ds=new System.Data.DataSet();
????this.da.SelectCommand=this.cmd;
????this.da.Fill(ds);
????return ds;
???}
???/// <summary>
???/// 對(duì)指定表,指定字段執(zhí)行加一計(jì)數(shù),返回計(jì)數(shù)后的值。條件由ConditionExpress指定。
???/// </summary>
???/// <param name="_tableName">表名稱。</param>
???/// <param name="_fieldName">字段名稱。</param>
???/// <returns>返回計(jì)數(shù)后的值。</returns>
???public int Count(string _tableName,string _fieldName)
???{
????this.tableName=_tableName;
????this.fieldName=_fieldName;
????int count=Convert.ToInt32(this.GetValue(this.tableName,this.fieldName));
????count++;
????this.cmd.Parameters.Clear();
????this.cmd.CommandText=string.Empty;
????this.AddFieldItem(_fieldName,count);
????this.Update(this.tableName);
????return count;
???}
???/// <summary>
???/// 對(duì)指定表,指定字段執(zhí)行減一計(jì)數(shù),返回計(jì)數(shù)后的值。條件由ConditionExpress指定。
???/// </summary>
???/// <param name="_tableName">表名稱。</param>
???/// <param name="_fieldName">字段名稱。</param>
???/// <returns>返回計(jì)數(shù)后的值。</returns>
???public int Substract(string _tableName,string _fieldName)
???{
????this.tableName=_tableName;
????this.fieldName=_fieldName;
????int count=Convert.ToInt32(this.GetValue(this.tableName,this.fieldName));
????if(count>0)count--;
????this.cmd.Parameters.Clear();
????this.cmd.CommandText=string.Empty;
????this.AddFieldItem(_fieldName,count);
????this.Update(this.tableName);
????return count;
???}
???/// <summary>
???/// 根據(jù)ConditionExpress指定的條件在指定表中刪除記錄。返回刪除的記錄數(shù)。
???/// </summary>
???/// <param name="_tableName">指定的表名稱。</param>
???/// <returns>返回刪除的記錄數(shù)。</returns>
???public int Delete(string _tableName)
???{
????this.tableName=_tableName;
????this.SqlCmd="delete from "+this.tableName;
????if(this.ConditionExpress!=string.Empty)
????{
?????this.SqlCmd=this.SqlCmd+" where "+this.ConditionExpress;
????}
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????return cmd.ExecuteNonQuery();
???}
??????????? /// <summary>
??????????? /// 函數(shù)sendMsg需要 __Receive接受者 如果是系統(tǒng)則為 admin 否則為手機(jī)號(hào)碼
??????????? /// </summary>
??????????? /// <param name="_PHONE">手機(jī)號(hào)碼</param>
??????????? /// <param name="_KeyWorld">關(guān)鍵字</param>
??????????? /// <param name="_INFO">信息的基本內(nèi)容</param>
??????????? /// <param name="_Receive">接受者</param>
??????????? /// <returns></returns>
??????????? public bool SendMsg(string _PHONE, string _KeyWorld, string _INFO, string _Receive)
??????????? {
??????????????? bool SendOk;
??????????????? if (_PHONE != null || _KeyWorld != null)
??????????????? {
??????????????????? this.Reset();
??????????????????? this.AddFieldItem("PHONE", _PHONE);
??????????????????? this.AddFieldItem("KeyWorld", _KeyWorld);
??????????????????? this.AddFieldItem("INFO", _INFO);
??????????????????? this.AddFieldItem("Receive", _Receive);
??????????????????? this.Insert("smsRawRecv").ToString();
??????????????????? SendOk = true;
??????????????? }
??????????????? else
??????????????? {
??????????????????? SendOk = false;
???????????????????
??????????????? }
??????????????? return SendOk;
??????????? }
??????????? /// <summary>
??????????? ///
??????????? /// </summary>
??????????? /// <param name="_PHONE"></param>
??????????? /// <param name="_KeyWorld"></param>
??????????? /// <param name="_INFO"></param>
??????????? /// <param name="_Receive"></param>
??????????? /// <returns></returns>
???????????? //public bool Received(string _PHONE, string _KeyWorld, string _INFO, string _Receive)
???????????? //{
???????????? //??? bool Received, SendOk;
???????????? //??? if (SendOk)
???????????? //??? {
???????????? //??????? if (_PHONE != null || _KeyWorld != null)
???????????? //??????? {
???????????? //??????????? this.Reset();
???????????? //??????????? this.AddFieldItem("PHONE", _PHONE);
???????????? //??????????? this.AddFieldItem("KeyWorld", _KeyWorld);
???????????? //??????????? this.AddFieldItem("INFO", _INFO);
???????????? //??????????? this.AddFieldItem("Receive", _Receive);
???????????? //??????????? this.Insert("smsSended").ToString();
???????????? //??????????? Received = true;
???????????? //??????? }
???????????? //??????? else
???????????? //??????? {
???????????? //??????????? Received = false;
???????????? //??????? }
???????????? //??? }
???????????? //??? else
???????????? //??? {
???????????? //??????? Received = false;
???????????? //??? }
???????????? //}
???/// <summary>
???/// 審核函數(shù)。將指定表,指定字段的值進(jìn)行翻轉(zhuǎn),如:1->0或0->1。條件由ConditionExpress指定。
???/// </summary>
???/// <param name="_tableName">表名稱。</param>
???/// <param name="_fieldName">字段名稱。</param>
???/// <returns>返回影響的行數(shù)。</returns>
???public int Audit(string _tableName,string _fieldName)
???{
????this.tableName=_tableName;
????this.fieldName=_fieldName;
????this.SqlCmd="update "+this.tableName+" set "+this.fieldName+"=1-"+this.fieldName;
????if(this.ConditionExpress!=string.Empty)
????{
?????this.SqlCmd=this.SqlCmd+" where "+this.ConditionExpress;
????}
????this.cmd.CommandText=this.SqlCmd;
????this.GenParameters();
????return cmd.ExecuteNonQuery();
???}
???/// <summary>
???/// 釋放資源
???/// </summary>
???public void Dispose()
???{
????conn.Close();
???}
??
??}
??/// <summary>
??/// 數(shù)據(jù)表中的字段屬性,包括字段名,字段值。
??/// 常用于保存要提交的數(shù)據(jù)。
??/// </summary>
??public class DbKeyItem
??{
???/// <summary>
???/// 構(gòu)造函數(shù)。
???/// </summary>
???/// <param name="_fieldName">字段名稱。</param>
???/// <param name="_fieldValue">字段值。</param>
???public DbKeyItem(string _fieldName,object _fieldValue)
???{
????this.fieldName=_fieldName;
????this.fieldValue=_fieldValue.ToString();
???}
???/// <summary>
???/// 字段名稱。
???/// </summary>
???public string fieldName;
???/// <summary>
???/// 字段值。
???/// </summary>
???public string fieldValue;
??}
?}
posted @
2007-07-27 11:09 華夢(mèng)行 閱讀(335) |
評(píng)論 (0) |
編輯 收藏
用了這么久的PHP,今天才知道原來(lái)PHP對(duì)函數(shù)名、類名大小寫不敏感。我一直都以為是跟變量名一樣大小寫敏感的。爆汗一下!!!,今天才發(fā)現(xiàn)PHP原來(lái)對(duì)函數(shù)名類名大小寫不敏感
NULL
類型只有一個(gè)值,就是大小寫敏感的關(guān)鍵字 NULL
posted @
2007-07-25 16:10 華夢(mèng)行 閱讀(282) |
評(píng)論 (0) |
編輯 收藏
端口沖突問(wèn)題,開(kāi)機(jī)后便宣布某個(gè)端口歸某個(gè)應(yīng)用程序所有
posted @
2007-07-25 15:55 華夢(mèng)行 閱讀(94) |
評(píng)論 (0) |
編輯 收藏
1下載 apatche http server,下php 安裝程序,?
2. 設(shè)置環(huán)境變量, class pass? php安裝路徑
3. 設(shè)置apatche的根路徑 doc_root ="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
posted @
2007-07-25 15:54 華夢(mèng)行 閱讀(100) |
評(píng)論 (0) |
編輯 收藏