|
I found a lot of information about SqlCommandBuilder, but the above examples update the database through DataSet, and I use DataTable and DataView, can anyone give me an example?
My program is as follows:
DataGird dg = new DataGird ();
DataTable dt = new DataTable ();
DataView dv = new DataView ();
SqlConnection conn = new SqlConnection (Sqlstring ());
SqlDataAdapter da = new SqlDataAdapter (Sqltxt, conn);
try
{
conn.Open ();
da.Fill (dt);
}
catch (Exception ex)
{
MessageBox.Show (ex.Message);
}
finally
{
conn.Close ();
}
dt.TableName = tableName;
dv.Table = dt;
dg.DataSource = dv; |
|