2,596
社区成员
发帖
与我相关
我的任务
分享
AseConnection con = new AseConnection("Data Source='SYBASE'; Port=5000; UID='sa'; PWD=''; Database='data';Connection Timeout='300';") ;
AseCommand com = new AseCommand("GetDataRightSQL", con) ;
com.CommandType = System.Data.CommandType.StoredProcedure ;
try
{
AseParameter prm = new AseParameter("@UserID", 1) ;
// prm.Direction = System.Data.ParameterDirection.Input ;
com.Parameters.Add(prm) ;
prm = new AseParameter("@Category","Department") ;
com.Parameters.Add(prm) ;
com.Parameters.Add(new AseParameter("@FieldName", "Dept_ID")) ;
prm = new AseParameter("@returnSql", AseDbType.VarChar, 250) ;
prm.Direction = System.Data.ParameterDirection.Output ;
com.Parameters.Add(prm) ;
con.Open() ;
com.ExecuteNonQuery() ;
con.Close() ; //提前关闭数据库
Console.WriteLine(com.Parameters["@returnSql"].Value) ;
}
finally
{
if( con != null && con.State == System.Data.ConnectionState.Open )
con.Close() ;
}
return ;