hello i'm trying to edit database from RadGridView, i'm using Scimore database and is connected to my GridView. I bind the itemsSource But if i change the data from Gridview, the database is not updated. why? how can i do that?
Here's my code :
XAML
<
Grid
>
<
StackPanel
x:Name
=
"LayoutRoot"
>
<
telerik:RadGridView
x:Name
=
"dataGrid1"
AutoGenerateColumns
=
"True"
ColumnWidth
=
"*"
ShowGroupPanel
=
"False"
CanUserReorderColumns
=
"False"
ItemsSource
=
"{Binding datatable.DefaultView}"
>
</
telerik:RadGridView
>
</
StackPanel
>
</
Grid
>
CS
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
string
dbInstanceName =
"C:\\Users\\Admin\\Documents\\Visual Studio 2010\\Projects\\DisplayDB\\DisplayDB\\configdb"
;
ScimoreEmbedded em =
new
ScimoreEmbedded();
em.Open(dbInstanceName);
try
{
using
(ScimoreConnection cn = em.CreateConnection())
{
cn.Open();
string
Query =
"select idx,tag,value from config.info"
;
ScimoreCommand createCommand =
new
ScimoreCommand(Query, cn);
createCommand.ExecuteNonQuery();
ScimoreDataAdapter dataAdp =
new
ScimoreDataAdapter(createCommand);
DataTable dataTable =
new
DataTable(
"info"
);
dataAdp.Fill(dataTable);
dataGrid1.ItemsSource = dataTable.DefaultView;
dataAdp.Update(dataTable);
}
}
catch
(Exception)
{
}
}
}