日期:2014-05-16 浏览次数:20477 次
private SqlDataAdapter adapter;
private DataSet dataSource;
string connectionString = "server=localhost; uid=sa; pwd=123; database=Courses";
string cmdString = "SELECT * FROM COURSE";
SqlConnection sqlConnection = new SqlConnection(connectionString);
SqlCommand sqlCmd = new SqlCommand(cmdString, sqlConnection);
sqlConnection.Open();
this.adapter = new SqlDataAdapter();
adapter.SelectCommand = sqlCmd;
this.dataSource = new DataSet();
adapter.Fill(dataSource, "COURSE");
int ret = this.adapter.Update(dataSource, "COURSE");