using system;
using system.configuration;
using system.data.sqlclient;
using system.data;
using system.collections;
比如:
// 打开数据库
try
{
mysqlconn.open();
}
catch (exception e)
{
//rethrow this exception
throw e;
}
return mysqlconn;
}
// 执行sql返回dataset
public static dataset getdataset(string sqlquery)
{
sqlconnection cn = dbobject.openconnection();
sqldataadapter da = new sqldataadapter(sqlquery, cn);
dataset ds = new dataset();
da.fill(ds);
//release resources
da.dispose();
da = null;
cn.close();
cn = null;
return ds;
}
// 执行sql语句
public static void executeupdatequery(string sqlquery)
{
sqlconnection cn = dbobject.openconnection();
sqlcommand cmd = new sqlcommand();
cmd.commandtext = sqlquery;
cmd.commandtype = commandtype.text;
cmd.connection = cn;
cmd.executenonquery();
cn.close();
cn = null;
}
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器