本文整理汇总了C#中DataSet.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.Dispose方法的具体用法?C# DataSet.Dispose怎么用?C# DataSet.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MailBodyOlustur
protected string MailBodyOlustur(int FirmaId, DateTime KalBitTar)
{
EFDal ed = new EFDal();
string MailBody = "";
MailBody += "<table border=\"1\"><tr>" +
"<td><b>Marka</b></td>" +
"<td><b>Model</b></td>" +
"<td><b>Seri No</b></td>" +
"<td><b>Kalibrasyon Tarihi</b></td>" +
"<td><b>Sertifika No</b></td>" +
"<td><b>Ölçüm Aralığı</b></td>" +
"</tr>";
DataSet ds = new DataSet();
ds = ed.FirmaIDveKalTardanCihazListesiDon(FirmaId, KalBitTar);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
MailBody += "<tr>";
string Marka = "<td>" + ds.Tables[0].Rows[i]["IMALATCI"].ToString() + "</td>";
string Model = "<td>" + ds.Tables[0].Rows[i]["MODEL"].ToString() + "</td>";
string SeriNo = "<td>" + ds.Tables[0].Rows[i]["SERINO"].ToString() + "</td>";
string KalBitTar2 = "<td>" + ds.Tables[0].Rows[i]["KALBITTAR"].ToString().Replace(" 00:00:00", "") + "</td>";
string SertifikaNo = "<td>" + ds.Tables[0].Rows[i]["SERTIFIKANO"].ToString() + "</td>";
string OlcAraligi = "<td>" + ds.Tables[0].Rows[i]["OLCUMARALIGI"].ToString() + "</td>";
MailBody += Marka + Model + SeriNo + KalBitTar2 + SertifikaNo + OlcAraligi + "</tr>";
}
MailBody += "</table>";
ds.Dispose();
return MailBody;
}
示例2: LoadActiveSubMenu
// To get 'SubMenu' record of 'Active' or 'Inactive' from database by stored procedure
public DataTable LoadActiveSubMenu(bool IsActive,int LoggedInUser, string RetMsg)
{
SqlConnection Conn = new SqlConnection(ConnString);
// 'uspGetSubMenuDetails' stored procedure is used to get specific records from SubMenu table
SqlDataAdapter DAdapter = new SqlDataAdapter("uspGetSubMenuDetails", Conn);
DAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet DSet = new DataSet();
try
{
DAdapter.SelectCommand.Parameters.AddWithValue("@IsActive", IsActive);
DAdapter.SelectCommand.Parameters.AddWithValue("@LoggedInUser", LoggedInUser);
DAdapter.SelectCommand.Parameters.AddWithValue("@RetMsg", RetMsg);
DAdapter.Fill(DSet, "Masters.SubMenu");
return DSet.Tables["Masters.SubMenu"];
}
catch
{
throw;
}
finally
{
DSet.Dispose();
DAdapter.Dispose();
Conn.Close();
Conn.Dispose();
}
}
示例3: DropDownList1_SelectedIndexChanged
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//get song name and value
DropDownList2.Visible = true;
string videoQuery = "SELECT video_id,video_name FROM video where singer_id =" + dropSingerValue.ToString() + ";";
SqlDataAdapter da2 = new SqlDataAdapter(videoQuery, conn);
DataSet ds2 = new DataSet();
da2.Fill(ds2);
if (ds2.Tables[0].Rows.Count > 0)
{
SingerName = DropDownList1.SelectedItem.Text;
SongName = "";
ds2.Dispose(); DropDownList2.Items.Clear();
DropDownList2.DataSource = ds2;
DropDownList2.DataTextField = "video_name";
DropDownList2.DataValueField = "video_id";
DropDownList2.DataBind();
DropDownList2.Items.Insert(0, new ListItem("-- Select Video --", "0"));
}
else
{
Response.Write("no data");
// Response.End();
}
}
示例4: ddlClass_SelectedIndexChanged
protected void ddlClass_SelectedIndexChanged(object sender, EventArgs e)
{
//If no Grade is Selected.
if (ddlClass.SelectedIndex != -1)
{
ddlStudent.Items.Clear();
ddlStudent.Items.Add(new ListItem("Select Student", "empty"));
OdbcDataAdapter adpNameList = DB_Connect.ExecuteQuery("SELECT `NAME_INITIALS` FROM `student_mast` S, `student_class` SC WHERE SC.SC_YEAR = YEAR(CURDATE()) AND SC.SC_GRADE='" + ddlGrade.SelectedIndex + "' AND SC.CLASS_CODE = '" + ddlClass.SelectedValue + "' AND SC.ADMISSION_NO = S.ADMISSION_NO");
adpNameList.SelectCommand.CommandType = CommandType.Text;
DataSet dsNameList = new DataSet();
adpNameList.Fill(dsNameList);
if (dsNameList.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < dsNameList.Tables[0].Rows.Count; i++)
{
ListItem lstNameList = new ListItem();
// or your index which is correct in your dataset
lstNameList.Value = dsNameList.Tables[0].Rows[i][0].ToString();
// or your index which is correct in your dataset
lstNameList.Text = dsNameList.Tables[0].Rows[i][0].ToString();
ddlStudent.Items.Add(lstNameList);
}
}
dsNameList.Dispose();
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Session["kullanici"] != null || Session["yonetici"] != null)
{
}
else
{
Response.Redirect("KullaniciGiris.aspx");
}
try
{
Yardimci.baglanti.Open();
SqlCommand sinif_cek = new SqlCommand();
sinif_cek.CommandText = "SELECT SINIF_ID, SINIF_AD FROM SINIFLAR";
sinif_cek.Connection = Yardimci.baglanti;
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(sinif_cek);
adp.Fill(ds, "SINIFLAR");
dwSiniflar.DataSource = ds.Tables["SINIFLAR"];
dwSiniflar.DataBind();
ds.Dispose();
adp.Dispose();
Yardimci.baglanti.Close();
}
catch (Exception hata)
{
Yardimci.baglanti.Close();
lbl_sonuc.Text = hata.Message;
}
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try {
string componentName = Request["componentName"];
string tokenName = Request["tokenName"];
string tokenValue = string.Empty;
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand("dbo.FSFPL_RestoreEditableContent");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("ComponentName", componentName);
cmd.Parameters.AddWithValue("TokenName", tokenName);
SqlConnection conn = new SqlConnection(SiteConfig.ConnectionString);
cmd.Connection = conn;
SqlDataAdapter sqlda = new SqlDataAdapter(cmd);
sqlda.Fill(ds);
// return data for display
tokenValue = ds.Tables[0].Rows[0]["TokenValue"].ToString();
// cleanup
conn.Close();
ds.Dispose();
cmd.Dispose();
sqlda.Dispose();
Response.Write(tokenValue);
} catch (Exception ex) {
Response.Write(ex.Message);
}
}
示例7: LoadCurriculum
// To get 'Curriculum' record of both 'Active','Inactive' type from database by stored procedure
public DataTable LoadCurriculum(int LoggedInUser, string Ret)
{
SqlConnection Conn = new SqlConnection(ConnStr);
// 'uspGetIntakeFormCurriculum' stored procedure is used to get both 'Active','Inactive' type records from Curriculum table
SqlDataAdapter DAdapter = new SqlDataAdapter("Transactions.uspGetIntakeFormCurriculum", Conn);
DAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DAdapter.SelectCommand.Parameters.AddWithValue("@LoggedInUser", LoggedInUser);
DAdapter.SelectCommand.Parameters.AddWithValue("@RetMsg", Ret);
DataSet DSet = new DataSet();
try
{
DAdapter.Fill(DSet, "Curriculum");
return DSet.Tables["Curriculum"];
}
catch
{
throw;
}
finally
{
DSet.Dispose();
DAdapter.Dispose();
Conn.Close();
Conn.Dispose();
}
}
示例8: LoadWS1Status
// To get 'WS1 Status' record of both 'Active','Inactive' type from database by stored procedure
public DataTable LoadWS1Status(int LoggedInUser, string Ret)
{
SqlConnection Conn = new SqlConnection(ConnStr);
// 'uspGetWS1StatusDetails' stored procedure is used to get both 'Active','Inactive' type records from WS1 Status table
SqlDataAdapter DAdapter = new SqlDataAdapter("Masters.uspGetWS1StatusDetails", Conn);
DAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DAdapter.SelectCommand.Parameters.AddWithValue("@LoggedInUser", LoggedInUser);
DAdapter.SelectCommand.Parameters.AddWithValue("@RetMsg", Ret);
DataSet DSet = new DataSet();
try
{
DAdapter.Fill(DSet, "WS1Status");
return DSet.Tables["WS1Status"];
}
catch
{
throw;
}
finally
{
DSet.Dispose();
DAdapter.Dispose();
Conn.Close();
Conn.Dispose();
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Session["kullanici"] != null || Session["yonetici"] != null)
{
}
else
{
Response.Redirect("KullaniciGiris.aspx");
}
try
{
Yardimci.baglanti.Open();
SqlCommand ogretmen_cek = new SqlCommand();
ogretmen_cek.CommandText = "SELECT * FROM OGRETMENLER_VIEW2";
ogretmen_cek.Connection = Yardimci.baglanti;
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(ogretmen_cek);
adp.Fill(ds, "OGRETMENLER_VIEW2");
dwOgretmenler.DataSource = ds.Tables["OGRETMENLER_VIEW2"];
dwOgretmenler.DataBind();
ds.Dispose();
adp.Dispose();
Yardimci.baglanti.Close();
}
catch (Exception hata)
{
Yardimci.baglanti.Close();
lbl_sonuc.Text = hata.Message;
}
}
示例10: LoadActiveStakeholderRelationshipManager
// To get 'Stakeholder Relationship Manager' record of 'Active' or 'Inactive' from database by stored procedure
public DataTable LoadActiveStakeholderRelationshipManager(int LoggedInUser, string returnmsg, bool IsActive)
{
SqlConnection Conn = new SqlConnection(ConnStr);
// 'uspGetStakeholderRelationshipManagerDetails' stored procedure is used to get specific records from Stakeholder Relationship Manager table
SqlDataAdapter DAdapter = new SqlDataAdapter("uspGetStakeholderRelationshipManagerDetails", Conn);
DAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DAdapter.SelectCommand.Parameters.AddWithValue("@LoggedInUser", LoggedInUser);
DAdapter.SelectCommand.Parameters.AddWithValue("@RetMsg", returnmsg);
DAdapter.SelectCommand.Parameters.AddWithValue("@IsActive", IsActive);
DataSet DSet = new DataSet();
try
{
DAdapter.Fill(DSet, "StakeholderRelationshipManager");
return DSet.Tables["StakeholderRelationshipManager"];
}
catch
{
throw;
}
finally
{
DSet.Dispose();
DAdapter.Dispose();
Conn.Close();
Conn.Dispose();
}
}
示例11: ddlGrade_SelectedIndexChanged
protected void ddlGrade_SelectedIndexChanged(object sender, EventArgs e)
{
//If no Grade is Selected.
if (ddlGrade.SelectedIndex != -1)
{
//Clear the excisting Items
ddlClass.Items.Clear();
//Clear the excisting Items
ddlClass.Items.Add(new ListItem("Select Class", "Empty"));
//Execute Query and
OdbcDataAdapter adpClassList = DB_Connect.ExecuteQuery("SELECT DISTINCT CLASS_CODE FROM student_class WHERE SC_GRADE='" + ddlGrade.SelectedValue + "'");
adpClassList.SelectCommand.CommandType = CommandType.Text;
DataSet dsClassList = new DataSet();
adpClassList.Fill(dsClassList);
if (dsClassList.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < dsClassList.Tables[0].Rows.Count; i++)
{
ListItem lstClassList = new ListItem();
// or your index which is correct in your dataset
lstClassList.Value = dsClassList.Tables[0].Rows[i][0].ToString();
// or your index which is correct in your dataset
lstClassList.Text = dsClassList.Tables[0].Rows[i][0].ToString();
ddlClass.Items.Add(lstClassList);
}
}
dsClassList.Dispose();
}
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if ( Session["yonetici"] != null)
{
}
else
{
Response.Redirect("KullaniciGiris.aspx");
}
try
{
Yardimci.baglanti.Open();
SqlCommand kullanici_Cek = new SqlCommand();
kullanici_Cek.CommandText = "SELECT * FROM KULLANICILAR";
kullanici_Cek.Connection = Yardimci.baglanti;
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter(kullanici_Cek);
adp.Fill(ds, "KULLANICILAR");
dwKullanicilar.DataSource = ds.Tables["KULLANICILAR"];
dwKullanicilar.DataBind();
ds.Dispose();
adp.Dispose();
Yardimci.baglanti.Close();
}
catch (Exception hata)
{
Yardimci.baglanti.Close();
lbl_sonuc1.Text = hata.Message;
}
}
示例13: GorevIDdenGrdiBagla
protected void GorevIDdenGrdiBagla(int GorevId)
{
EFDal ed = new EFDal();
DataSet ds = new DataSet();
ds = ed.GorevFirmaDon(GorevId);
GridView1.DataSource = ds;
GridView1.DataBind();
ds.Dispose();
}
示例14: ddlStudentName_SelectedIndexChanged
protected void ddlStudentName_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlStudentName.SelectedIndex != -1)
{
OdbcDataAdapter adpAdNoList = DB_Connect.ExecuteQuery("SELECT S.`ADMISSION_NO` FROM `student_mast` S, `student_class` SC WHERE SC.SC_YEAR = YEAR(CURDATE()) AND SC.SC_GRADE='" + ddlGrade.SelectedIndex + "' AND S.NAME_INITIALS='" + ddlStudentName.SelectedValue + "'AND SC.CLASS_CODE = '" + ddlClass.SelectedValue + "' AND SC.ADMISSION_NO = S.ADMISSION_NO");
adpAdNoList.SelectCommand.CommandType = CommandType.Text;
DataSet dsAdNoList = new DataSet();
adpAdNoList.Fill(dsAdNoList);
adNo = dsAdNoList.Tables[0].Rows[0][0].ToString();
dsAdNoList.Dispose();
}
}
示例15: FormRUSM
public int FormRUSM(int IDMAIN)
{
command = new SqlCommand("DELETE TECHNOLOG_VVV..RUSM;", conbase01);
conbase01.Open();
command.CommandTimeout = 1200;
command.ExecuteNonQuery();
conbase01.Close();
int IDMt = IDMAIN;
//int IDMt = 1202423;
da.SelectCommand = new SqlCommand();
da.SelectCommand.CommandText = " SELECT ID FROM " + BAZA + "..DATAEXT "
+ " WHERE IDMAIN=" + IDMt.ToString() + " and MNFIELD=921 AND MSFIELD='$b' AND SORT='Изданиекартографическое'";
da.SelectCommand.Connection = conbase03;
da.SelectCommand.CommandTimeout = 1200;
DataSet ds921 = new DataSet();
int K921 = da.Fill(ds921);
ds921.Dispose();
if (K921 > 0)
{
return 1; // Карты не обрабатываются
}
PBJ2RUSM(IDSession, IDMt, "n"); // Создание таблицы RUSM
da.SelectCommand = new SqlCommand();
da.SelectCommand.CommandText = " SELECT ID,POL "
+ " FROM TECHNOLOG_VVV..RUSM "
+ " WHERE IDMAIN=" + IDMt.ToString() + " and session='" + IDSession + "'"
+ " AND MET=102";
da.SelectCommand.Connection = conbase01;
da.SelectCommand.CommandTimeout = 1200;
DataSet dsZ = new DataSet();
int K102 = da.Fill(dsZ);
if (K102 > 0)
{
K102 = Int32.Parse(dsZ.Tables[0].Rows[0]["ID"].ToString());
P102 = dsZ.Tables[0].Rows[0]["POL"].ToString().Replace("'", "~") + (char)31 + "2VGBILGEO";
R = " UPDATE TECHNOLOG_VVV..RUSM SET POL =N'" + P102 + "' WHERE ID=" + K102;
command = new SqlCommand(R, conbase01);
conbase01.Open();
command.CommandTimeout = 1200;
command.ExecuteNonQuery();
conbase01.Close();
}
//CONTROL101(IDSession, IDMt); // Проверка поля Языки
OBR98(IDSession, IDMt, "n"); // ФОРМИРОВАНИЕ ПОЛЯ 801 - Источник записи
//=========================================================================================================Саша, здесь RUSM сформирована=======================================
return 0;
// цикл по IDM
}