本文介绍了如何将存储过程输出到gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DataTable dt = new DataTable();
//Open Connection
try
{
string conHostName = "172.21.0.45";
string conPort = "1522";
string conDatabase = "ora11gv4";
string _dbUserName = "ScibasePD";
string _dbPwd = "ScibasePD";
string conStr = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4};",
conHostName, conPort, conDatabase, _dbUserName, _dbPwd);
OracleConnection con = new OracleConnection(conStr);
con.Open();
// define Command
using (OracleCommand cmd = new OracleCommand())
{
//// create & define the parameter
//var refCursorParam = new OracleParameter();
//refCursorParam.ParameterName = "";
//refCursorParam.OracleType = OracleType.Cursor;
//refCursorParam.Direction = ParameterDirection.Output;
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "REPORTS.GET_DAILY_STATUS";
//define the data adapter and fill the dataset
using (OracleDataAdapter oda = new OracleDataAdapter(cmd))
{
oda.Fill(dt);
}
}
bindingSource1.DataSource = dt;
}
catch (Exception ex)
{
throw ex;
}
推荐答案
这篇关于如何将存储过程输出到gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!