本文整理汇总了C#中DataTable.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# DataTable.Dispose方法的具体用法?C# DataTable.Dispose怎么用?C# DataTable.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTable
的用法示例。
在下文中一共展示了DataTable.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
string sAllUser = AllUser.Text;
DataTable dt = new DataTable();
for (int i = 0; i < Function.GetSplit(sAllUser, "|").Length; i++)
{
muser = buser.GetUser(Function.GetSplit(sAllUser, "|")[i]);
if (muser.UserID != 0)
{
dt = bll.GetList(" where ReceiverId=" + muser.UserID + "");
if (dt.Rows.Count > 0)
{
for (int d = 0; d < dt.Rows.Count; d++)
{
bll.Delete(int.Parse(dt.Rows[d]["WMId"].ToString()));
}
}
}
}
Label1.Text = dt.Rows.Count.ToString();
dt.Clear();
dt.Dispose();
Table1.Visible = false;
Table2.Visible = true;
}
示例2: Buscar
protected void Buscar()
{
Ocultar();
fondoPensiones _fondoPensiones = new fondoPensiones(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString());
DataTable _dataTable = new DataTable();
switch (this.DropDownList_BUSCAR.SelectedValue)
{
case "NOMBRE":
_dataTable = _fondoPensiones.ObtenerPorNombre(this.TextBox_BUSCAR.Text);
break;
}
if (_dataTable.Rows.Count > 0)
{
GridView_RESULTADOS_BUSQUEDA.DataSource = _dataTable;
GridView_RESULTADOS_BUSQUEDA.DataBind();
Mostrar(Acciones.BusquedaEncontro);
}
else
{
if (!String.IsNullOrEmpty(_fondoPensiones.MensajeError)) Informar(Label_MENSAJE, "Error: Consulte con el Administrador: " + _fondoPensiones.MensajeError, Proceso.Error);
else Informar(Label_MENSAJE, "ADVERTENCIA: No se encontró información para " + this.DropDownList_BUSCAR.SelectedItem + " : " + this.TextBox_BUSCAR.Text, Proceso.Correcto);
Mostrar(Acciones.BusquedaNoEncontro);
}
_dataTable.Dispose();
}
示例3: isiTeknis
public void isiTeknis()
{
if (Session["groups"] is object)
{
groups = Session["groups"].ToString();
}
if (groups.ToString() == "1")
{
query = @"SELECT DISTINCT b.UserssIDents,b.UserssNamess FROM landcomp.SRHTRM a
INNER JOIN landcomp.USERSS b
ON a.srhtrmUsrSrh = b.UserssIDents";
}
else
{
query = @"SELECT DISTINCT b.UserssIDents,b.UserssNamess FROM landcomp.SRHTRM a
INNER JOIN landcomp.USERSS b
ON a.srhtrmUsrSrh = b.UserssIDents
WHERE a.srhtrmUsrTrm = '" + userid + "'";
}
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddfil.Items.Clear();
ddfil.Items.Add(new ListItem("Lihat Semua Berkas Yang Di Terima", "0"));
ddfil.Items.Add(new ListItem("Lihat Semua Berkas Yang Di Kirim", "1"));
for (int i = 0; i < dt.Rows.Count; i++)
{
//ddfil.Items.Add(new ListItem(dt.Rows[i]["UserssNamess"].ToString(), dt.Rows[i]["UserssIDents"].ToString()));
}
}
dt.Dispose();
}
示例4: getPartNoHistory
public static string getPartNoHistory(string iPN,string code)
{
//string result = "<span>No user found!</span>";
DataTable dt = new DataTable();
using (Multek.SqlDB sqldb = new Multek.SqlDB(__conn))
{
string sql = "select top 10 OEM,plant,cus_part_no,qty,price,amount,sqft,asp = case when amount=0 or sqft=0 then 0 else amount/sqft end,"+
"Convert(datetime, gamDate, 112) as lastDate from dbo.cemFC_ship_and_mss where [email protected] and [email protected] order by gamDate desc";
SqlCommand cmd = new SqlCommand(sql);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@ipn", iPN);
cmd.Parameters.AddWithValue("@code", code);
dt = sqldb.getDataTableWithCmd(ref cmd);
cmd.Connection.Dispose();
cmd.Dispose();
}
StringBuilder sb = new StringBuilder();
sb.Append("<table class='standardTable' border='1' cellpadding='1' cellspacing='0' borderColor='#cccccc' width='250' bgcolor='#FFFBBC'>"+
"<tr bgcolor='#C6976B'><th>Part#</th><th>Qty</th><th>Price</th><th>Amount</th><th>Sqft</th><th>ASP</th><th>Date</th></tr>");
foreach (DataRow row in dt.Rows)
{
//sb.Append(String.Format("<tr><td nowrap=true>{0}</td><td align='right'>{1:N0}</td><td>{2:N3}</td><td>{3:d}</tr>", row[2], row[3],row[4],row[8]));
sb.Append(String.Format("<tr bgcolor='#C5EACB'><td>{0}</td><td align='right'>{1:N0}</td><td align='right'>{2:N2}</td><td align='right'>{3:N2}</td><td align='right'>{4:N4}</td><td align='right'>{5:N2}</td><td>{6:dd MMM yyyy}</tr>",
row[2], row[3], row[4],row[5],row[6],row[7], row[8]));
}
sb.Append("</table>");
dt.Dispose();
return sb.ToString();
}
示例5: GetAll
private void GetAll()
{
DataTable dt = new DataTable();
dt=BCustomForm.GetAll();
RepCustomForm.DataSource = dt;
RepCustomForm.DataBind();
dt.Clear();
dt.Dispose();
}
示例6: GetEligibleParticipants
/// <summary>
/// Gets all participants that are eligible for the oncology trial.
/// </summary>
/// <returns>List of eligible Participant objects</returns>
public ICollection<Participant> GetEligibleParticipants()
{
string query = String.Format("SELECT * FROM {0} WHERE {1}=1 ORDER BY {2}",
Table.TABLE_NAME, Table.IS_ELIGIBLE, Table.LAST_NAME);
SqlCommand command = new SqlCommand(query);
DataTable dataTable = new DataTable();
ExecuteFillDataTable(command, dataTable);
ICollection<Participant> participantList = ParticipantCollectionFromDataTable(dataTable);
dataTable.Dispose();
return participantList;
}
示例7: GetParticipantsForPcp
public ICollection<Participant> GetParticipantsForPcp(string pcpUsername)
{
string query = String.Format("SELECT * FROM {0} WHERE {1}='{2}' ORDER BY {3}",
Table.TABLE_NAME, Table.PCP_USERNAME, pcpUsername, Table.LAST_NAME);
SqlCommand command = new SqlCommand(query);
DataTable dataTable = new DataTable();
ExecuteFillDataTable(command, dataTable);
ICollection<Participant> participantList = ParticipantCollectionFromDataTable(dataTable);
dataTable.Dispose();
return participantList;
}
示例8: GetUserPieChart
private void GetUserPieChart()
{
using (SqlConnection con = new SqlConnection(Helper.GetCon()))
using (SqlCommand cmd = new SqlCommand())
{
con.Open();
cmd.Connection = con;
cmd.CommandText = "SELECT Types.UserType, COUNT(Types.UserType) AS Composition " +
"FROM dbo.Users INNER JOIN Types ON Users.TypeID=Types.TypeID " +
"GROUP BY Types.UserType";
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dsChartData = new DataTable();
StringBuilder strScript = new StringBuilder();
dsChartData = ds.Tables[0];
strScript.Append(@"<script type='text/javascript'>
google.load('visualization', '1', {packages: ['corechart']}); </script>
<script type='text/javascript'>
function drawChart() {
var data = google.visualization.arrayToDataTable([
['User Type', 'Percent'],");
foreach (DataRow row in dsChartData.Rows)
{
strScript.Append("['" + row["UserType"] + "'," + row["Composition"] + "],");
}
strScript.Remove(strScript.Length - 1, 1);
strScript.Append("]);");
strScript.Append(@" var options = {
title: '',
is3D: true,
}; ");
strScript.Append(@"var chart = new google.visualization.PieChart(document.getElementById('piechart_user'));
chart.draw(data, options);
}
google.setOnLoadCallback(drawChart);
");
strScript.Append(" </script>");
ltUserComposition.Text = strScript.ToString();
dsChartData.Dispose();
strScript.Clear();
}
}
示例9: isiNegoKe
public void isiNegoKe()
{
query = @"SELECT codessCodess, codessDescs1 FROM landcomp.CODESS WHERE codessHeadss=24 AND codessStatss=1 ORDER BY codessCodess ASC";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddNegosiasi.Items.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
ddNegosiasi.Items.Add(new ListItem(dt.Rows[i]["codessDescs1"].ToString(), dt.Rows[i]["codessCodess"].ToString()));
}
}
dt.Dispose();
}
示例10: isiPeriode
public void isiPeriode()
{
query = @"SELECT codessDescs1, codessCodess FROM CODESS WHERE codessHeadss = '9'";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddprg.Items.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
ddprg.Items.Add(new ListItem(dt.Rows[i]["codessDescs1"].ToString(), dt.Rows[i]["codessCodess"].ToString()));
}
}
dt.Dispose();
}
示例11: isiTeknis
public void isiTeknis()
{
query = @"SELECT GroupsNamess, GroupIDents FROM GROUPS WHERE GroupIDents != 1";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddprg.Items.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
ddprg.Items.Add(new ListItem(dt.Rows[i]["GroupsNamess"].ToString(), dt.Rows[i]["GroupIDents"].ToString()));
}
}
dt.Dispose();
}
示例12: group
public void group()
{
query = @"SELECT GroupsNamess, GroupIdents FROM GROUPS";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddGroup.Items.Clear();
//ddLanjut.Items.Add(new ListItem("Pilih Kabupaten", "0"));
for (int i = 0; i < dt.Rows.Count; i++)
{
ddGroup.Items.Add(new ListItem(dt.Rows[i]["GroupsNamess"].ToString(), dt.Rows[i]["GroupIdents"].ToString()));
}
}
dt.Dispose();
}
示例13: isiTeknis
public void isiTeknis()
{
query = @"SELECT GrupmnModuls,GrupmnUserId FROM GRUPMN WHERE GrupmnModuls ='BERKS1'";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddteknis.Items.Clear();
//ddLanjut.Items.Add(new ListItem("Pilih Kabupaten", "0"));
for (int i = 0; i < dt.Rows.Count; i++)
{
ddteknis.Items.Add(new ListItem(dt.Rows[i]["GrupmnUserId"].ToString()));
}
}
dt.Dispose();
}
示例14: isiDesa
public void isiDesa()
{
query = @"SELECT mdesaaIddesaa, mdesaaNmdesa FROM almis.MDESAA";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddDesa.Items.Clear();
ddDesa.Items.Add(new ListItem("Pilih Desa", "0"));
for (int i = 0; i < dt.Rows.Count; i++)
{
ddDesa.Items.Add(new ListItem(dt.Rows[i]["mdesaaNmdesa"].ToString(), dt.Rows[i]["mdesaaIddesaa"].ToString()));
}
}
dt.Dispose();
}
示例15: isiTeknis
public void isiTeknis()
{
query = @"SELECT codessDescs1 codessCodess FROM CODESS WHERE codessHeadss = '9'";
dt = getDataTable(query);
if (dt.Rows.Count > 0)
{
ddprg.Items.Clear();
//ddLanjut.Items.Add(new ListItem("Pilih Kabupaten", "0"));
for (int i = 0; i < dt.Rows.Count; i++)
{
ddprg.Items.Add(new ListItem(dt.Rows[i]["codessCodess"].ToString()));
}
}
dt.Dispose();
}