C# :: Entity Framework - Select Specific Column In Tables
Apr 28, 2015
I need to show in a comboBox thats shows infor from Entity framework but i need to select a specific colum in the tables..
All in C# visual studio xaml form
So I created a var but i get and output: name of programe.NLHEntities
using (var context = new NLHEntities()) {
var blog = context.EtagesChambres
.Where(b => b.TypeChanbre == "Prive")
.FirstOrDefault();
textBox2Type.Text = Convert.ToString(blog);// i put a text box to see what the output would be..
}
View 14 Replies
ADVERTISEMENT
Apr 15, 2015
I'm a bit unsure on where to put cascading deletes in my models and how far they extend.
I've got four tables
TrafficLog
has a One to One with
TransactionHistory
Has a zero to Many with
OutgoingService
and
Exceptions
Now i'd like to put cascading deletes on, so that if i delete a record from TrafficLog it deletes from the other three.
So do i set up my model with cascade delete just on the primary like this
modelBuilder.Entity<TCC_ArchivedApplicationTrafficLog>()
.HasRequired(TCC_ArchivedTransactionHistory)
.WithRequiredDependent()
.WillCascadeOnDelete(true);
or do i need to enable it on the other three tables too?
View 3 Replies
View Related
Nov 3, 2012
I developed a sample application in EF which has 3 tables
PersonDetails, BankDetails and FixedDepositDetails.
Please find the table structure below
create table PersonDetails
(PersonId int Primary Key,
PersonName varchar(30))
create table BankDetails
(BankId int Primary Key,
BankName varchar(100),
[Code] ....
But when I run the application I get an error as
The navigation property 'Bank_Id' is not a declared property on type 'FixedDepositDetails'. Verify that it has not been explicitly excluded from the model and that it is a valid navigation property.
If I am not wrong I think I have made some mistakes when creating the model.
View 1 Replies
View Related
Aug 27, 2014
Yes, exactly, and I have been successfully creating EF Model before from the same database.... Why is it acting up now... I did check SO and they seems not to have a solution for it also....
View 8 Replies
View Related
May 29, 2014
I want to select three columns from my text file i.e. Empl No, Start Date and Created Date. After selecting this, I want to insert the data into a database.
I have attached a copy of the text file.
I have the following code so far:
if (File.Exists(filename))
{
string[] lines = File.ReadAllLines(filename);
for (int y = 0; y < lines.Length; y++) {
Console.WriteLine(lines[y].ToString());
}
How do i select specific details for each employee
View 1 Replies
View Related
Nov 21, 2013
I have a .txt file which contains 121 lines,now I want to read the no 20 columns from that file. How to read it. I have tried the following code.
my c.txt file look like following :
A B C D E.....AAA
#include<stdio.h>
#include "conio.h"
#include "string.h"
int main() {
FILE *fp;
char a2[500];
[Code] ....
View 1 Replies
View Related
Mar 5, 2013
How do I make a specific character show up a specific amount of times?
Like I am generating a random number then I need to make "|" show up that many times on the screen.
View 1 Replies
View Related
Dec 9, 2014
I've got a datagrid setup and i'm using an entity model as the datasource, i thought i had stuctured my query so that i would only get a single column result but the display within the datagrid shows two columns?
here's the xaml for the form
<Window x:Class="UpdateAccelaAssets.winUsersRemove"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Remove User" Height="300" Width="300">
[Code] .....
And I've attached a screenshot of the result.
Attached image(s)
View 3 Replies
View Related
Nov 15, 2014
Ok so I have a function call that moves an Entity from one vector to another, and if one doesn't exist then it creates one and moves it:
std::vector<std::unique_ptr<Entity>> ActiveEntities;
std::vector<std::unique_ptr<Entity>> EntityPool;
// Creates a generic entity in the entity pool
void EntityManager::CreateEntity() {
[Code] .....
In this case it checks the entity pool for an entity, if one exists it moves it to the active entities and then returns the unique id, if one doesn't exist it creates one then calls itself to run the check again to verify and move the new entity.
My question is, is this a valid form of recursion since it only incurs a single loop of recursion, or should I reform the entire system to work differently? If so, how do you set this up in a way that does not cause recursion?
View 3 Replies
View Related
Mar 8, 2014
I'm new to C programming and I need to write a "small" expandable menu framework and I don't know where to start off.
This is my task: Create an expandable menu framework in C where you can add a infinite number of entries and Sub menus containing other Menu points or where the entries refer to a external function. So far I've created the structures I need
Code:
//Menu structure
struct menu {
char mtitel[MAX];
struct mpoint point;
struct menu *next, *prev;
[Code] .....
View 2 Replies
View Related
Dec 20, 2014
I'm working on a game with an entity-component system. I have a Manager class that is handling all of the components by feeding them into vectors set up for each type of component. Right now I have a lot of repeated code for each kind of component.
void add_pos_comp(shared_ptr<Position> pos_comp);
shared_ptr<Position> get_pos_comp(int id);
const vector<shared_ptr<Position>>& get_pos_comps();
void add_vel_comp(shared_ptr<Velocity> vel_comp);
shared_ptr<Velocity> get_vel_comp(int id);
const vector<shared_ptr<Velocity>>& get_vel_comps();
I've tried generalizing this with templates, but I've been confused by how I should organize the collection of vectors for each component. I had it setup so that they were all in an unordered_map, but how to get the templated functions to find the right map slot to use based simply on the template's parameters.
The full project is here for reference: [URL] ....
View 2 Replies
View Related
Jan 10, 2015
To the topic: I've been following "SDL game development" book by Shaun Mitchell and (besides the many others in the past) I've encountered a problem in one of the chapters.
I'm in "creating and displaying tile maps". The chapter uses tintxml to load data outside the code, which is used to create a "map screen".
The problem is that the program work perfect except for not loading and/or rendering this "screen".
I know this is too vague of an explanation, but I wouldn't know what else to say.
I'm leaving the link to the repository with all the code: [URL]...
View 12 Replies
View Related
Mar 23, 2014
So I'm trying to accomplish something that right seems to hard for it to be worth it. I'm trying to write a plugin framework/system for my game. I have read about it and everything that pops up says it's OS-specific and you have to load the plugins from either a .so file on linux or from a .dll file on Windows. So here lie my questions:
-Is there any universal way of accomplishing this?
-Every way I've seen assumes i know the names of the functions I'm calling which doesn't hold true if the plugin are written by a 3rd party. How would i turn the table on this matter?
View 1 Replies
View Related
Feb 23, 2014
I am trying to load a .bmp file located in the same folder as main.cpp etc. but I'm not sure what to input as the resource path so that it picks it up and, when I distribute it, I want it to be preferably cross platform and run smoothly.
I have tried using:
hello_world.bmp
SDL_Game/hello_world.bmp (SDL_Game is the name of the project)
but it will work if I use the full path. I don't want to do this though, because then it will not work on other computers and platforms.
This is the function I use to load media:
bool loadMedia() {
// Loading success flag
bool success = true;
// Load splash image
gHelloWorld = SDL_LoadBMP("hello_world.bmp");
[Code] ....
I am using XCode 5, SDL2.0.1, OSX 10.9 Mavericks and C++.
View 2 Replies
View Related
Apr 17, 2013
i have created application using gembox i create a word file and save data on it but i want after saving it itis opened to me using microsoft word directly
it is the code
DocumentModel document1 = new DocumentModel();
Section section1 = new Section(document1);
document1.Sections.Add(section1);
[Code]....
View 1 Replies
View Related
Jun 3, 2013
For my homework I need to create a hash table with a size of 7. I also need to create a queue that holds 3 names maximum for each table position
View 1 Replies
View Related
Mar 7, 2014
I need to run some basic statistics on about ~150 tables that are currently in dBase format. Rather than use excel to do them all individually, i was told to use s+ and write a code to loop through them, but I have never written any code and my experience with spotfire s+ is limited (the stat software i have available) ....
View 4 Replies
View Related
May 23, 2014
In my code I have lots of structures. I try to make tables of structures and then get access to elements of the structures to use them all along my code: here is an example to clarify things
typedef struct {
Fabric **closfabric;
}Network;
Net is part of another structure called Switch and Fabric itself is a composed structure. I have done the following
aSwitch->net.closfabric = (Fabric **)malloc(3* sizeof(Fabric *));
aSwitch->net.closfabric[0] = (Fabric *)malloc(m * sizeof(Fabric ));
aSwitch->net.closfabric[1] = (Fabric *)malloc(k * sizeof(Fabric ));
aSwitch->net.closfabric[2] = (Fabric *)malloc(m * sizeof(Fabric ));
The compilation returns a segmentation fault because aSwitch->net.closfabric is NULL (0) .
Surprisingly, in other codes the same analogy of using tables made of double pointers works perfectly with no problems and I have no problem of core dumped and NULL pointers.
Why am I getting this problem. It is the case whenever I try to use large dimension tables (tab *** struct for example)...
View 2 Replies
View Related
Feb 8, 2014
I have to write a program to display multiplication tables. I have written the following code:
Code:
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
[Code] ....
View 2 Replies
View Related
Jul 23, 2014
i'm trying to update multiple table values with same column using one query.
Here's what i've tried so far:
mySql.CommandText = "Update tbl_employees,tbl_emp_additional_info,tbl_allocated_deductions,tbl_benefits,
tbl_cashadvances,tbl_deduction_history,"+
"tbl_dtr,tbl_empabsences,tbl_empstatus,tbl_otherdeductions
,tbl_ots,tbl_payroll_history,tbl_rdcomments,tbl_reversed_deductions,tbl_reversed_deduction_paid "+
"set tbl_employees.emp_id=@newemp_id,tbl_emp_additional_info.emp_id=@newemp_id,tbl_allocated_deductions.
[code]...
I've also tried removing all the other "and" operators but still no luck.It doesn't throw in exception yet it doesn't update my tables column values.
View 14 Replies
View Related
Dec 18, 2014
I am creating 5 different tables each one has 20000 more elements more than the previous when i try to sort them with the sort algorithm quick sort for the first table tha has 20000 elements runs grate then it throws this exception how is this fixable ?
Exception : terminate called after throwing an instanceof 'std::bad_alloc' this application has Requested the Runtime to terminate it in an unusual way. Please contact the applications's support team for more information. Process returned 255(0xFF) . here is the code that gives this return :
Code:
#include<time.h>
#include<stdlib.h>
#include <string.h>
#include <ctime>
using namespace std;
int * Create_Table(int table[],int N);
[Code] .....
View 10 Replies
View Related
Dec 17, 2013
Currently I have to manually look up values on several different tables in different locations. I have 8 or 10 tables with 100 to 500 parts.
I would like to write a program so if I enter a value it will return the corresponding correct answers from the tables.
If I entered 2.5 for a value it would return the following three items from the tables since they all meet the requirement.
Table 2
Part min max
235 2.4 2.9
Table 6
Part min max
589 2.3 2.5
Table 7
Part min max
12 2.3 2.7
What would the best method be for setting up and accessing tables like this? Is C++ good at representing something like this or should I be looking at a different language?
View 3 Replies
View Related
Dec 5, 2014
i have stuck in a join and i cant figure out where the problem is, i have those tables
public class Themes
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[Code].....
View 12 Replies
View Related
Nov 10, 2014
The problem is that the data table doesn't show at all. Here is the code:
<%@ Page Title="" Language="C#" MasterPageFile="~/LB/MasterPage.master" AutoEventWireup="true" CodeFile="InsertedInfo.aspx.cs" Inherits="LB_InsertedInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
[Code]....
View 5 Replies
View Related
May 8, 2014
Basically I have a few tables in my Database.
So I have one table that is like so:
Item_ID, Name, Parent ID.
1 , jeff , 5
and another table like this:
Parent_ID, parent_Name
5,jackson
What I would like to happen, when I run my code is that I'll get the following
Item_ID, Name, parent_Name
1 , jeff , jackson
DataSet DS = new DataSet();
if (this.OpenConnection() == true) {
mySqlDataAdapter = new MySqlDataAdapter("select Item_ID, NAME, Parent_ID from table1, table2", connection);
mySqlDataAdapter.Fill(DS);
dataGridView1.DataSource = DS.Tables[0];
//close connection
this.CloseConnection();
}
So this spit out parent ID = 5.
I've not worked with Dataset before and I was just wondering what is the best approach? Can this be done via a SQL command or will I have to replace the value(5) with the string(jackson) using a large IF loop to search and replace.
View 1 Replies
View Related
Jun 13, 2014
I'm trying ultimately to do a radix sort. I'm going with the implementation using two tables. One will initially hold the unsorted values then hold the partially sorted values thereafter. The other will be an array of linked lists which will be where the radix sort is done. Here is my code thus far:
Main
#include <iostream>
#include <fstream>
#include "radix.h"
#include "radix.cpp"
using namespace std ;
int main ( int argc , char * argv [ ] ) {
ifstream input ( argv [ 1 ] ) ;
[Code] ....
It appears to be crashing during void insert_into_sorted ( int to_insert , int place ) ; and I'm not sure why.
View 2 Replies
View Related