using System;
using System.Data.SqlClient;
class Test
{
private SqlConnection Conn;
private DataSet ds;
private SqlDataAdapter da;
private SqlCommandBuilder cb;
public Test()
{
//建立数据库链接,把table表中的所有数据读取到DataSet中.
ds = new DataSet( "DS" );
Conn = new SqlConnection( "Data Source=localhost;Initial Catalog=Test;User Id=sa;Password=;" );
da = new SqlDataAdapter( "select * from table", Conn );
da.Fill( ds );
//你对dataset的修改
da.Update(ds);
Conn.Close();
}
不是很懂你说的意思,直接替换sql语句改变ds?