|
Hi guys,
I am working MVC and entity framework to build up my knowledge.
I craeted database. then I create Entity framework in Model Folder.next, Create View.
In Model Folder I created Partial class which the purpose of this class is to encapsulate the data which interact with aother layers or DB.
So far, I haven't any problem because I realized everything regarding Entity framework. the problem is I don't know what is next step. What I have to write. I just wanna get same data from database and show them up on the form.
Please someone help me in this matter,
what is next step?
thx heaps
|
|
|
|
|
|
Hi, Firstly, thank you for your help.
Look, I followed the steps. I created a Controller.(Customer Controller)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Practice1.Models;
using Practice1.Models.Repository;
namespace Practice1.Controllers
{
[HandleError]
public class CustomerController : Controller
{
TestDBEntities _db;
public CustomerController()
{
TestDBEntities _db = new TestDBEntities();
}
public ActionResult Index()
{
ViewData.Model = _db.Tbl_Customer.ToList();
return View();
}
public ActionResult About()
{
return View();
}
}
}
AS, I am following your link, I got confused. Could you please tell me where I have to add this code? which part? do I need to create another class
ViewData.Model = _db.MovieSet.ToList();
ViewData.Model = (from m in _db.MovieSet select m).ToList();
|
|
|
|
|
Hi,
The controller should be placed in the controllers directory in the MVC project.
About the two lines of code you wrote:
ViewData.Model = _db.MovieSet.ToList();
ViewData.Model = (from m in _db.MovieSet select m).ToList();
They are doing the same thing. The first is getting all the movies form the database and returns them as list using the context you use. The second uses Linq to Entities to return all the movies from the database as list.
|
|
|
|
|
i have a dataGrid view in my windows form and now i want bind it programatically. i write this code::
string ConnString = "";
sqlConnection conn = new SqlConnection (ConnString);
string sql = "";
sqlDataAdapter da = new SqlDataAdapter(sql,conn);
conn.open()l
dataset ds = new dataset();
da.fill(ds);
conn.close();
datagridview1.DataSource = ds;
my code is right and ds hase 1 record and fill right but my grid dont show any record
do u know why?
has anything that i dont
|
|
|
|
|
your code is incomplete. Add the following line end of your code.
datagridview1.Databind();
|
|
|
|
|
but my form is windows form not web form and it has no databind,
what is insted of that in windows form?
|
|
|
|
|
ptvce wrote: but my form is windows form not web form
Then why you posted this question in ASP.Net forum, you should have posted it in C# forum.
|
|
|
|
|
1. Don't cross post at multiple forums. Pick one and stick to it.
Repost[^]
|
|
|
|
|
datagridview1.DataSource = ds.Tables[0];
|
|
|
|
|
|
Hallo everybody, I am using using a Custom control inside an aspx page and such user control includes a public property, so I need to access from the aspx.cs to the object created and stablish a value for the public property, but I have problem because the page doesn't recognize the object, the register data is:
<%@ Register TagPrefix="Data" TagName="Navegador" Src="~/Controles_Usuario/Navegador.ascx" %>
and the inclusion sentence: <data:navegador id="NV1" runat="Server">
later from the aspx.cs code I try to access to NV1.Property1 = 1;
and it yields an error telling that the page doesn't recognize NV1 and if I define it with protected Navegador NV1, the error is JUST REDEFINED
So Please where is the error, because I find this kind of errors each time when I use Custom Controls.
|
|
|
|
|
Hi guys, I am new in Entityframework and trying to get more knowledge. I have got one question and hope u guys help me out.
When we create Entity Model, after finish the process, a class designer.cs created automatically. why this file created and what we have to write in this file?
thx
|
|
|
|
|
A little googling[^] will help you.
Just try to explore it by yourself.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi,
The class designer.cs is the product of code generation which create the relevant entities and context that you will need in order to communicate with the database. You shouldn't change the generated code! All the entities and the context are created as partial classes so you can add your own behavior in another partial class.
I hope it will help you.
|
|
|
|
|
Hi every1,
Could you please, some one tell me in explicit language what is ORM and what are the advantages of using it?
thx
|
|
|
|
|
Well,
ORM in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language.
Simple details about it can be read here: WIKI ORM[^]
|
|
|
|
|
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language.
Advantages of ORM as as follows:
1. Facilitates implementing the Domain Model pattern.
2. Huge reduction in code.
3. Changes to the object model are made in one place.
4. Rich query capability.
5. Navigation.
6. Data loads are completely configurable allowing you to load the data appropriate for each scenario.
7. Concurrency support.
8. Cache managment.
9. Transaction management and Isolation.
10. Key Management.
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
|
Hi,
I use a xmldatasource to display news from another site on mine. But in the description there is an image that i dont know how to retrieve? I get a "empty" image icon.
Can anyone help out? I use, XPath="rss/channel/item" and the image is under description i think..
thanks in advance
Thommie
|
|
|
|
|
I found one useful link[^] for the same.
It contains example to retrieve image from RSS feed.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
couldn´t get it to work with XPath like i retrieve alla the rest information, any ideas?
|
|
|
|
|
How to append a new line to a richtextbox in c#.net
|
|
|
|
|
what happen to your old friend new line character '\n'
|
|
|
|
|
RichTextBox.Text = "1st line<br/> 2nd line";
makhaai
modified on Saturday, July 24, 2010 3:44 AM
|
|
|
|