本文整理汇总了C#中OracleDataAdapter.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# OracleDataAdapter.Dispose方法的具体用法?C# OracleDataAdapter.Dispose怎么用?C# OracleDataAdapter.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleDataAdapter
的用法示例。
在下文中一共展示了OracleDataAdapter.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteListadeSetores
public static Boolean ExecuteListadeSetores(
ConnectionInfo pInfo, decimal pSET_ID, string pCHAVE
)
{
Boolean values;
try
{
string lQuery = "";
DataTable lTable = new DataTable();
OracleCommand cmd = new OracleCommand();
using (OracleConnection cn = new OracleConnection(pInfo.ConnectionString))
{
cmd.Connection = cn;
cmd.CommandText = "spLista";
cmd.CommandType = CommandType.StoredProcedure;
//cmd.CommandText = " BEGIN spLista (" + pSET_ID + ", " + pCHAVE + "); END; ";
cmd.Parameters.Add("pSET_ID", OracleDbType.Decimal).Value = pSET_ID;
cmd.Parameters.Add("pCHAVE", OracleDbType.Decimal).Value = pCHAVE;
cn.Open();
DataSet ds = new DataSet();
OracleDataAdapter Adapter = new OracleDataAdapter(cmd);
Adapter.Fill(ds);
Adapter.Dispose();
values = true;
cmd.Dispose();
cn.Dispose();
cn.Close();
}
return values;
}
catch (Exception ex)
{
values = false;
}
return values;
}
示例2: UpdateTidbitSDR
public static bool UpdateTidbitSDR(int tidbitTypeId, Int32 refId, int tidbitOrder, string tidbitText = "", string timecode = "", bool enabled = false, int newTidbitOrder = 0)
{
OracleConnection cn = null;
OracleCommand cmd = null;
OracleDataAdapter adp = null;
OracleCommandBuilder bldr = null;
DataTable tbl = null;
DataRow row = null;
bool updated = false;
try
{
cn = createConnectionSDR();
string sql = "select * from drafttidbits where referencetype = " + tidbitTypeId + " and referenceid = " + refId + " and tidbitorder = " + tidbitOrder;
cmd = new OracleCommand(sql, cn);
adp = new OracleDataAdapter(cmd);
bldr = new OracleCommandBuilder(adp);
tbl = new DataTable();
adp.Fill(tbl);
if (tbl.Rows.Count == 0)
{
row = tbl.Rows.Add();
}
else
{
row = tbl.Rows[0];
}
row["referencetype"] = tidbitTypeId;
row["referenceid"] = refId;
if (newTidbitOrder > 0)
{
row["tidbitorder"] = newTidbitOrder;
}
else
{
row["tidbitorder"] = tidbitOrder;
}
row["text"] = tidbitText;
row["enabled"] = enabled;
//row["timecode"] = timecode;
adp.Update(tbl.GetChanges());
tbl.AcceptChanges();
updated = true;
}
catch (Exception ex)
{
}
finally
{
if (cmd != null) cmd.Dispose();
if (adp != null) adp.Dispose();
if (bldr != null) bldr.Dispose();
if (tbl != null) tbl.Dispose();
}
return updated;
}
示例3: RetrieveRecords
public DataTable RetrieveRecords()
{
OracleConnection con = new OracleConnection(cnString);
OracleDataAdapter da = new OracleDataAdapter("select employeeid, firstname, lastname, email, phonenumber from employeess", con);
//da.SelectCommand.CommandType = CommandType.StoredProcedure;
OracleCommandBuilder bui = new OracleCommandBuilder(da);
DataTable dt = new DataTable();
try
{
da.Fill(dt);
return dt;
}
catch
{
throw;
}
finally
{
da.Dispose();
con.Close();
con.Dispose();
}
}
示例4: mgffill
void mgffill()
{
try
{
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
string sqlquery = "SELECT MGF_NAME FROM MFG_INFO ORDER BY MGF_NAME";
OracleCommand cmd = new OracleCommand(sqlquery, conn);
OracleDataAdapter oda = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
oda.Fill(dt);
if (dt.Rows.Count > 0)
{
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "MGF_NAME";
if (comboBox1.Items.Count > 0)
{
comboBox1.SelectedIndex = -1;
}
}
oda.Dispose();
cmd.Dispose();
conn.Close();
}
catch (Exception exe)
{
MessageBox.Show(exe.Message);
}
}
示例5: UpdateTable
public bool UpdateTable(DataTable table, string tableName)
{
try
{
TableHelper.SetDefaultColumnValues(table);
var con = CONNECTION.OpenCon();
var adapter = new OracleDataAdapter(string.Format(@"SELECT * FROM {0}", tableName), con);
var cmd = new OracleCommandBuilder(adapter);
adapter.Update(table);
cmd.Dispose();
adapter.Dispose();
CONNECTION.CloseCon(con);
return true;
}
catch (DBConcurrencyException cex)
{
SLLog.WriteError(new LogData
{
Source = ToString(),
FunctionName = "UpdateTable DBConcurrencyError!",
Ex = cex,
});
return false;
}
catch (Exception ex)
{
SLLog.WriteError(new LogData
{
Source = ToString(),
FunctionName = "UpdateTable Error!",
Ex = ex,
});
return false;
}
}
示例6: mgffill
void mgffill()
{
try
{
conn.Open();
string sqlquery = "SELECT MGF_NAME FROM MFG_INFO ORDER BY MGF_NAME";
OracleCommand cmd = new OracleCommand(sqlquery, conn);
OracleDataAdapter oda = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
oda.Fill(dt);
if (dt.Rows.Count > 0)
{
comboBox1.DataSource = dt;
comboBox1.DisplayMember = "MGF_NAME";
//comboBox1.ValueMember = "Cust_Name";
}
oda.Dispose();
cmd.Dispose();
conn.Close();
}
catch (Exception exe)
{
MessageBox.Show(exe.Message);
}
}
示例7: ExecuteReaderToDataTable
public DataTable ExecuteReaderToDataTable(string TableName)
{
try
{
DataTable dt = new DataTable(TableName);
OracleDataAdapter da = new OracleDataAdapter((OracleCommand)this.Command);
da.Fill(dt);
da.Dispose();
return dt;
}
catch (Exception ex)
{
LoggingHelper.Debug("-----Oracle ExecuteReaderToDataTable Error----");
LoggingHelper.Debug(ex.Message);
return null;
}
}
示例8: Fetch_DataSet
public DataSet Fetch_DataSet(string strSql)
{
objConnection = open_connection();
objDataSet = new DataSet();
objAdapter = new OracleDataAdapter(strSql, objConnection);
objAdapter.Fill(objDataSet);
//objDatareader.Close();
objAdapter.Dispose();
objConnection.Close();
objConnection.Dispose();
return objDataSet;
}
示例9: Fetch_StoredDataSet
public DataSet Fetch_StoredDataSet(string strSP, string tablename, params OracleParameter[] paramObj)
{
objConnection = open_connection();
objDataSet = new DataSet();
objCommand = new OracleCommand(strSP, objConnection);
objCommand.CommandType = CommandType.StoredProcedure;
if (paramObj != null)
{
foreach (OracleParameter paramVal in paramObj)
{
objCommand.Parameters.Add(paramVal);
}
}
OracleParameter oparam = objCommand.Parameters.Add("cur_user", OracleDbType.RefCursor);
oparam.Direction = ParameterDirection.Output;
objAdapter = new OracleDataAdapter(objCommand);
objAdapter.Fill(objDataSet, tablename);
//objDatareader.Close();
objAdapter.Dispose();
objConnection.Close();
objConnection.Dispose();
return objDataSet;
}
示例10: BindFormView
public FormView BindFormView(FormView grdVGenIn, string strSqlIn)
{
objConnection = open_connection();
if (open_con == true)
{
try
{
objDataSet = new DataSet();
objAdapter = new OracleDataAdapter(strSqlIn, objConnection);
objAdapter.Fill(objDataSet, "tblGrdV");
grdVGenIn.DataSource = objDataSet.Tables["tblGrdV"].DefaultView;
grdVGenIn.DataBind();
gridView_bind = true;
return grdVGenIn;
}
catch (OracleException objError)
{
if (objError.Message.Substring(0, 21) == "Table does not exist.")
{
ErrorStr = ErrorMsg(objConnection, "MSG1201");
}
else if (objError.Message.Substring(59, 25) == "ORA-00904: invalid column name")
{
ErrorStr = ErrorMsg(objConnection, "MSG1202");
}
else
{
ErrorStr = objError.Message;
err_flag = true;
}
gridView_bind = false;
return null;
}
finally
{
objConnection.Close();
objConnection.Dispose();
objAdapter.Dispose();
}
}
else
{
return null;
}
}
示例11: BindGrid
//public void SetFocus(Control control)
//{
// StringBuilder sb = new StringBuilder();
// sb.Append("\r\n<script language='JavaScript'>\r\n");
// sb.Append("<!--\r\n");
// sb.Append("function SetFocus()\r\n");
// sb.Append("{\r\n");
// sb.Append("\tdocument.");
// Control p = control.Parent;
// while (!(p is System.Web.UI.HtmlControls.HtmlForm)) p = p.Parent;
// sb.Append(p.ClientID);
// sb.Append("['");
// sb.Append(control.UniqueID);
// sb.Append("'].focus();\r\n");
// sb.Append("}\r\n");
// sb.Append("window.onload = SetFocus;\r\n");
// sb.Append("// -->\r\n");
// sb.Append("</script>");
// control.Page.RegisterClientScriptBlock("SetFocus", sb.ToString());
//}
public DataGrid BindGrid(DataGrid dgrdGen, string strSql)
{
objConnection = open_connection();
if (open_con == true)
{
try
{
objDataSet = new DataSet();
objAdapter = new OracleDataAdapter(strSql, objConnection);
objAdapter.Fill(objDataSet, "role_id");
dgrdGen.DataSource = objDataSet.Tables["role_id"].DefaultView;
dgrdGen.DataBind();
grid_bind = true;
return dgrdGen;
}
catch (OracleException objError)
{
if (objError.Message.Substring(0, 21) == "Table does not exist.")
{
ErrorStr = ErrorMsg(objConnection, "MSG1201");
}
if (objError.Message.Substring(59, 30) == "ORA-00904: invalid column name")
{
ErrorStr = ErrorMsg(objConnection, "MSG1202");
}
grid_bind = false;
return null;
}
finally
{
objConnection.Close();
objConnection.Dispose();
objAdapter.Dispose();
}
}
else
{
return null;
}
}
示例12: LoadRecords
public static DataSet LoadRecords(string SQL)
{
OracleDataAdapter da = new OracleDataAdapter();
OracleCommand cmd = new OracleCommand();
DataSet ds = new DataSet(); ;
string sql = string.Empty;
try
{
cmd.Connection = Conexao.GetInstance();
cmd.CommandType = CommandType.Text;
sql = SQL;
cmd.CommandText = sql;
da.SelectCommand = cmd;
da = new OracleDataAdapter(cmd);
da.Fill(ds, "Table");
//=====================================================================|
//Finaliza ds
da.Dispose();
cmd.Dispose();
return ds;
}
catch (Exception ex)
{
sErrMsg = "Atenção, a função de recuperação de dados (Certificados/Etiquetas) " +
"detectou o seguinte problema:" +
"\r\n" + "\r\n" +
"Descrição : " + ex.Message.ToString() + "\r\n" +
"Origem : " + ex.Source.ToString();
sErrCap = "Procedimento : " + ex.TargetSite.ToString();
MessageBox.Show(sErrMsg, sErrCap, MessageBoxButtons.OK,
MessageBoxIcon.Error);
da.Dispose();
cmd.Dispose();
ds.Dispose();
return null;
}
}
示例13: ImportPlayers
//.........这里部分代码省略.........
{
row["kiperrank"] = Convert.ToInt16(xmlRow["kiperrank"].ToString());
}
else
{
row["kiperrank"] = DBNull.Value;
}
if (xmlRow["mcshayrank"].ToString() != "")
{
row["mcshayrank"] = Convert.ToInt16(xmlRow["mcshayrank"].ToString());
}
else
{
row["mcshayrank"] = DBNull.Value;
}
row["height"] = xmlRow["height"].ToString();
if (xmlRow["weight"].ToString().Trim() != "")
{
row["weight"] = xmlRow["weight"].ToString() + " LBS";
}
else
{
row["weight"] = "";
}
row["class"] = xmlRow["class"].ToString();
adp.Update(tbl.GetChanges());
tbl.AcceptChanges();
cmd.Dispose();
adp.Dispose();
bldr.Dispose();
tbl.Dispose();
DataTable tblTids = null;
try
{
int noteCount;
if (ConfigurationManager.AppSettings["DraftType"].ToString().ToUpper() == "NBA")
{
noteCount = 2;
}
else
{
noteCount = 4;
}
for (int i = 1; i <= noteCount; i++)
{
if (xmlRow.Table.Columns["matrixnote" + i.ToString()] != null)
{
if (xmlRow["matrixnote" + i.ToString()].ToString().Trim() != "")
{
sql = "select * from espnews.drafttidbits where referenceid = " + xmlRow["playerid"] + " and referencetype = 1 and tidbitorder = " + i;
cmd = new OracleCommand(sql, cn);
adp = new OracleDataAdapter(cmd);
bldr = new OracleCommandBuilder(adp);
tblTids = new DataTable();
DataRow rowTids = null;
示例14: GetDllNames
/// <summary>
/// Get New Dll names from db
/// </summary>
/// <returns></returns>
public DataSet GetDllNames()
{
OracleConnection con = new OracleConnection(GetOracleConnectionString());
string strsql = "select dll_name,dll_version from application_dll where application_version=2 order by dll_name";
try
{
OracleDataAdapter objda = new OracleDataAdapter(strsql, con);
DataSet ds = new DataSet();
objda.Fill(ds);
objda.Dispose();
return ds;
}
catch (Exception ex)
{
WriteLog(ex.ToString());
return null;
}
finally
{
if (con.State == ConnectionState.Open)
con.Dispose();
}
return null;
}
示例15: ImportTeams
public static void ImportTeams(string file)
{
int teamsImported = 0;
int importErrors = 0;
int teamsToImport = 0;
SetStatusBarMsg("Importing teams info...", "Yellow");
BackgroundWorker worker = new BackgroundWorker();
worker.WorkerReportsProgress = true;
worker.DoWork += delegate(object s, DoWorkEventArgs args)
{
OracleConnection cn = null;
OracleCommand cmd = null;
OracleDataReader rdr = null;
OracleDataAdapter adp = null;
OracleCommandBuilder bldr = null;
MySqlConnection cnMySql = null;
MySqlCommand cmdMySql = null;
MySqlDataReader rdrMySql = null;
MySqlDataAdapter adpMySql = null;
MySqlCommandBuilder bldrMySql = null;
//DataTable tblPlayer = null;
DataTable tbl = null;
DataRow row;
string sql;
//long teamId;
int i;
int totalPicks = 0;
DataSet dsTeams = new DataSet();
dsTeams.ReadXml(file);
try
{
cn = createConnectionSDR();
teamsToImport = dsTeams.Tables["team"].Rows.Count;
foreach (DataRow xmlRow in dsTeams.Tables["team"].Rows)
{
totalPicks = 0;
if (xmlRow["teamid"].ToString().Trim() != "")
{
if (ConfigurationManager.AppSettings["DraftType"].ToUpper() == "NFL")
{
#region Picks
try
{
sql = "select count(*) from draftorder where teamid = " + xmlRow["teamid"];
cmd = new OracleCommand(sql, cn);
adp = new OracleDataAdapter(cmd);
tbl = new DataTable();
adp.Fill(tbl);
if (tbl.Rows.Count > 0)
{
totalPicks = int.Parse(tbl.Rows[0][0].ToString());
}
}
finally
{
cmd.Dispose();
adp.Dispose();
tbl.Dispose();
}
#endregion
#region 6 Matrix Notes
//import the 4 matrix notes
for (i = 1; i <= 6; i++)
{
if (xmlRow["note" + i.ToString()].ToString().Trim() != "")
{
sql = "select * from espnews.drafttidbits where referencetype = 2 and tidbitorder = " + i.ToString() + " and referenceid = " + xmlRow["teamid"];
cmd = new OracleCommand(sql, cn);
adp = new OracleDataAdapter(cmd);
bldr = new OracleCommandBuilder(adp);
tbl = new DataTable();
adp.Fill(tbl);
if (tbl.Rows.Count == 0)
{
row = tbl.Rows.Add();
//.........这里部分代码省略.........