以Oracle為例
參數對應
view plainprint?
public static int UploadStartCloseSoftInfo(string[] args)
{
OracleParameter parameter
parameter
OracleParameter parameter
parameter
OracleParameter parametern = new OracleParameter(參數名n
parametern
OracleParameter[] parameter
= {parameter
return SDProvider
}
}
}
執行
view plainprint?
public class SDProvider
{
public static string GetConnectionString()
{
string conStr =連接數據庫字符串;
return conStr ;
}
public static int RunProcedure(string prName
{
try
{
using(OracleConnection connection=
new OracleConnection(GetConnectionString()))
{
connection
OracleCommand command =
BuildQueryCommand(connection
return command
}
}
catch
{
}
return
}
private static OracleCommand BuildQueryCommand
(OracleConnection connection
string storedProcName
IDataParameter[]parameters)
{
OracleCommand command = new OracleCommand(storedProcName
command
if(parameters!=null)
{
foreach (OracleParameter parameter in parameters)
{
command
}
}
return command;
}
}
注意
From:http://tw.wingwit.com/Article/program/ASP/201311/21743.html