TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tavos tavos
NA
163
1.4k
Comparing two table IDs. ASP.NET MVC
Dec 14 2020 10:11 AM
I am currently loading two Orders and Colors tables, I wanted the Colors table to list the items that have the ID equal to Orders. For this, what occurred to me was to assign the IdOrders values to a variable and compare it with my IdOrders (in my table Colors), but it is not possible to assign the database's balance to my variable
My tables:
public
partial
class
Orders {
public
int
ID_Orders {
get
;
set
;
}
public
Nullable < System.DateTime > Data_Registo {
get
;
set
;
}
public
string
Num_Encomenda {
get
;
set
;
}
public
string
Ref_Cliente {
get
;
set
;
}
}
public
partial
class
Colors {
public
int
ID_Orders {
get
;
set
;
}
public
int
ID_Programa_Malha {
get
;
set
;
}
public
int
ID_Linha_Cor {
get
;
set
;
}
public
string
Cor {
get
;
set
;
}
}
I am working with a database already in operation and possible these tables are already used in a sql join but not how to process that information.
As I said the first thing I remembered was to do this:
My Controller:
var id = from d
in
db.Orders select d.ID_Orders;
var color = db.Colors.Where(x =>x.ID_Orders = id).ToList();
var tables =
new
EncomendaViewModel {
Orders = db.Orders.ToList(),
Colors = color.ToList(),
};
return
View(tables);
Error in id: CS0029 C# Cannot implicitly convert type to 'int' Erro id
Is it possible to process the data in this way?
Thanks for anyone who can help!
------------(Update)---------------
Using == cs0019 operator '==' cannot be applied to operands of type error2
My view in Broswer view
Reply
Answers (
2
)
How to handle SQL Server IMAGE data type as TEXT data type
I need to validate all fields in my application before submitting data