111,098
社区成员




string rPair = (sender as ComboBox).SelectedItem.ToString();
DataTable tablek = new DataTable();
string sqlc = string.Format("select * from CUsers where 段数='{0}'", rPair);
SQLDataAdapter.Fill(sqlc, tablek);
dataGrid1.ItemsSource = tablek.DefaultView;
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
string sqlc =string.Format( "select * from CUsers where 段数='{0}'", Customer.Sites);
DataTable tabled = dataGrid1.ItemsSource;
SQLHelper.UpdateDataTable(sqlc, tabled);
MesgBox.Show("客户资料保存成功!", 1);
dataGrid1.ItemsSource = tabled.DefaultView;
}
public static DataTable UpdateDataTable(string SqlString, DataTable table)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlDataAdapter Adapter = new SqlDataAdapter();
Adapter.SelectCommand = new SqlCommand(SqlString, connection);
SqlCommandBuilder builder = new SqlCommandBuilder(Adapter);
Adapter.Update(table);
return table;
}
}