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">FinishButton><
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
shaji pdPosted Nov 30, 2007, 4:57 AM
Error seems to be DATABASE related....... it seems the user does not have permission to executing SQL.. try USE connection with USER which has got DATABASE PERMISSION