java中调用存储过程
public int ExecProcAdd()
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "adduser";//拿到存储过程的名字
//--------------------------------带参数的存储过程(3个)-----------------------------------------
SqlParameter p1 = new SqlParameter("@username",typeof(string));
SqlParameter p2 = new SqlParameter("@userpwd",typeof(string));
//-----------------------------------------------------------------------------------------
//用sqldbtype.int不会出错,最好用它
SqlParameter p3 = new SqlParameter("@userid",SqlDbType.Int);
//有返回值的存储过程
p3.Direction = ParameterDirection.Output;
p1.Value = "张三";//给带的参数赋值
p2.Value = "123456";
//将其加入到
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
cmd.Parameters.Add(p3);
cmd.Connection = Conn;
//-------------------------------------------------------------
相关文档:
此个类是为了方便初学者对XML到 javabean 的相互转换不熟悉而写的:
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class XmlBean {
/*
* @AUTHOR:ZHONG
* @CREATETIME:2010/02/10
* @PREAM:OBJECT(JAVABEAN)
* @RETURN:X ......
http://techpool.javaeye.com/blog/486326
2009-10-12
JAVA如何执行DOS命令
JAVA如何执行DOS命令
下面是一种比较典型的程序模式:
...
Process process = Runtime.getRuntime().exec(".\\p.exe");
process.waitfor( );
... ......
JAVA反射机制
JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法;这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反射机制。
Java反射机制主要提供了以下功能: 在运行时判断任意一个对象所属 ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:Verdana;
panose ......
使用Runtime.getRuntime().exec()方法可以在java程序里运行外部程序。
1. exec(String command)
2. exec(String command, String envp[], File dir)
3. exec(String cmd, String envp[])
4. exec(String cmdarray[])
5. exec(String cmdarray[], String envp[])
6. exec(S ......