我的应用程序有 5 个文本框,我希望在我的ExecuteInsert
函数中包含它们的内容。现在我的Button
包含以下绑定。
<Button
Content="Add"
HorizontalAlignment="Left"
Margin="22,281,0,0"
VerticalAlignment="Top"
Width="75"
Command="{Binding Add}"
CommandParameter="{Binding ElementName=txtname}"
RenderTransformOrigin="1.023,0.765"/>
我的ExecuteInsert
功能如下。我只想传递多个命令参数意味着(多重绑定)有人可以帮忙吗?
private void ExecuteInsert(object obj)
{
TextBox textbox = obj as TextBox;
try
{
ExecuteConnect(obj);
oleDbCommand.CommandText = "INSERT INTO emp(FirstName)VALUES ('" + textbox.Text + "')";
oleDbCommand.ExecuteNonQuery();
MessageBox.Show("Data Saved");
}
catch (Exception ex)
{
MessageBox.Show("ERROR" + ex);
}
}