多種資料庫操作

2021-09-30 07:53:03 字數 1791 閱讀 5733

using system;

using system.data;

using system.configuration;

using system.linq;

using system.web;

using system.web.security;

using system.web.ui;

using system.web.ui.htmlcontrols;

using system.web.ui.webcontrols;

using system.web.ui.webcontrols.webparts;

using system.xml.linq;

using system.data.oledb;

using system.data.sqlclient;

//using system.data.oracleclient;   //由於oracle沒有安裝,在此捨去oracle的除錯

namespace myweb

///

/// 訪問資料庫

///

public class mydbhelper

return con;

}///

/// 建立並初始化command物件例項

///

/// sql查詢字串或儲存過程名臣

/// 資料提供程式型別

/// 資料庫連線例項

/// 返回乙個已經建立好的command例項物件

public static idbcommand createcommand(string cmdtext, databasetype dbtype, idbconnection con)

return cmd;

}///

/// 建立並初始化乙個dataadapter物件例項

///

/// command例項物件

/// 資料提供程式型別

/// 返回乙個已經建立好的idbdataadapter物件

public static idbdataadapter createdataadapter(idbcommand cmd, databasetype dbtype)

return adapter;

}#endregion

#region 執行資料庫操作語句

public mydbhelper()

///

/// 執行增刪改操作,uid是cuid中的

///

/// 執行操作的sql字串

public void executeuid(string cmdtext)

catch (exception)

finally}}

///

/// 執行增刪改操作,uid是cuid中的

///

/// 執行操作的sql字串

/// 引數

public void executeuid(string cmdtext,idbdataparameter parameter)

con.open();

cmd.executenonquery();

}catch (exception)

finally}}

///

/// 執行查詢操作,c代表cuid中的c

///

/// 查詢sql語句

/// 返回dataset物件

public dataset executec(string cmdtext)

#endregion}}

Java多種資料庫連線

jdbc odbc string driver sun.jdbc.odbc.jdbcodbcdriver string url jdbc odbc dbsource dbsource為資料來源名 string username username 使用者名稱 string password passw...

jmeter多種資料庫指令碼

可根據不同的查詢型別設定 jdbc請求中的 query type 一 單條查詢語句 query type select statement 二 多條查詢語句 包括增刪改查 query type callable statement 另外jdbc配置元件中的 database url末尾加上?allo...

多種資料庫的處理方式

1 oracle8 8i 9i資料庫 thin模式 載入驅動 class.forname oracle.jdbc.driver.oracledriver string url jdbc oracle thin localhost 1521 orcl orcl為資料庫的sid string user ...