Problem in data binding with WPF

Oct 21 2007 10:22 AM

Hi everybody

i met some problem in a simple test to data binding with the WPF

my XAML code as the following

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition Width="200"/>

<ColumnDefinition Width="200"/>

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition Height="30"/>

<RowDefinition Height="60"/>

<RowDefinition Height="60"/>

<RowDefinition Height="60"/>

<RowDefinition Height="60"/>

<RowDefinition Height="60"/>

<RowDefinition Height="60"/>

</Grid.RowDefinitions>

<xcdg:DataGridControl x:Name="OrdersGrid"

CellEditorDisplayConditions="None"

EditTriggers="None"

ReadOnly="True"

ItemScrollingBehavior="Immediate"

NavigationBehavior="RowOnly"

AutoCreateColumns="True">

</xcdg:DataGridControl>

<Button Name="btnFinish" Width="100" Height="30"

Grid.Column="2" Grid.Row="2"

Click="OnFinishClick">Finish</Button>

<TextBox Name="txtFirstName" Width="200" Height="30"

Grid.Column="1" Grid.Row="1"/>

</Grid>

 

when the user click the button, system should retrieve some data from the database and show cell of the result table in the text box ... as the following:

private void OnFinishClick(object sender, RoutedEventArgs e)

{

//txtFirstName.Text = "test";

DataSet dataSet = new DataSet();

DataTable m_orders = new DataTable();

string connString;

connString = "initial catalog=PADB-v2.3_2.4Hamouda;user id=ahmedh;password=ahmedh;data source=AHMEDH-SRV";

SqlConnection conn = new SqlConnection(connString);

SqlDataAdapter adapter = new SqlDataAdapter();

adapter.SelectCommand = new SqlCommand("SELECT * FROM ActivityDefinition;", conn);

conn.Open();

adapter.Fill(dataSet, "Orders");

m_orders = dataSet.Tables["Orders"];

conn.Close();

txtFirstName.Text = m_orders.Rows[0].ItemArray[2].ToString();

}

 

when running and clicking the button, i recieve this error "Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed".

this although when trying the same code in asp, it works properly.

any advices will be appreciated :)

NAHR ELGANNAH


Brought to you by:

Answers (1)