Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to dispose a DataSet
Message
De
08/05/2005 22:01:33
 
 
À
08/05/2005 21:16:20
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01012057
Message ID:
01012067
Vues:
23
Hi Kevin,


Here is the code from the main form
private void button1_Click(object sender, System.EventArgs e)
{
frmDialog frmDiag = new frmDialog()
if(frmDiag.showdialog == DiaglogResult.OK)
{
frmDiag.Dispose();
}
}


Now here is the code of the dialog form

public frmDialog()
{
string strConn = "Password=ga;Persist Security Info=True;User ID=sa;Initial Catalog=Northwind;Data Source=MICHAEL";
string strSql = "Select * from mySampTable";
SqlConnection cn = new SqlConnection(strConn);
SqlDataAdapter da = new SqlDataAdapter(strSql,cn);
DataSet ds = new DataSet();
da.Fill(ds);
this.dataGrid2.DataSource = ds.Tables[0];

cn.Close();
cn.Dispose();
}
Music Rocks www.musicreserve.blogspot.com
Success is 1% Inspiration & 99% Perspiration
God Sometimes Delays His Help to Test Our Faith and Energize Our Prayers
Our Boat May Be Tossed While He Sleeps, But He Wakes Up Before it Sinks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform