nunolevezinho Posted August 29, 2012 at 11:49 AM Report Share #473959 Posted August 29, 2012 at 11:49 AM Boas, estou com um erro um pouco chato ja ha algum tempo e nao consigo resolver nem por nada :\ O erro está numa class chamada Geral que usa Linq2SQL. Supostamente o erro que me dá é que não adicionei a reference ao projecto mas ja verifiquei umas 10 vezes e está la adicionado. public bool IsvalidUser(string Username, string Password) { Password = getMD5Hash(Password); BaseDadosInforDataContext db = new BaseDadosInforDataContext(); //The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. var query = from p in db.Funcionarios where p.Utilizador == Username && p.Password == Password select p; if (query.Any()) { return true; } else { return false; } } Estive ja a pesquisar na net sobre este erro e dizem mesmo para tentar adicionar manualmente a assembly no web.config. Já o fiz e continua sem dar :\ Alguma sugestão? Link to comment Share on other sites More sharing options...
pikax Posted August 29, 2012 at 12:51 PM Report Share #473964 Posted August 29, 2012 at 12:51 PM qual e' a versao da .Net framework que estas a utilizar? Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast." Link to comment Share on other sites More sharing options...
nunolevezinho Posted August 29, 2012 at 12:53 PM Author Report Share #473965 Posted August 29, 2012 at 12:53 PM 4.5 que veio com o VS 12 Link to comment Share on other sites More sharing options...
pikax Posted August 29, 2012 at 01:01 PM Report Share #473967 Posted August 29, 2012 at 01:01 PM muda o projecto para a 4.0, e volta a fazer referencia. Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast." Link to comment Share on other sites More sharing options...
nunolevezinho Posted August 29, 2012 at 01:16 PM Author Report Share #473968 Posted August 29, 2012 at 01:16 PM (edited) Já fiz isso e ocorre algo ainda pior, As minhas referencias do 4.5 depois deixam todas de funcionar :\ Não havera ainda o dll do Linq para 4.5? é que o vs12 é relativamente recente.. Edited August 29, 2012 at 01:16 PM by nunolevezinho Link to comment Share on other sites More sharing options...
pikax Posted August 29, 2012 at 01:24 PM Report Share #473969 Posted August 29, 2012 at 01:24 PM Estive a testar aqui no meu VS12 e funciona perfeitamente, ate' removi a referencia do linq e mesmo assim funciona. Esta' aqui o teste que estou a fazer, so' bastou meter o using do linq using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows.Forms; namespace DragDropOutlook { public partial class Form1 : Form { public Form1() { InitializeComponent(); List<int> list = new List<int>(); for (int i = 0; i < 25; i++) list.Add(i); var query = from e in list orderby e descending select e; foreach (var item in query) MessageBox.Show(item.ToString()); } } } Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast." Link to comment Share on other sites More sharing options...
nunolevezinho Posted August 29, 2012 at 01:41 PM Author Report Share #473970 Posted August 29, 2012 at 01:41 PM Será por estar a fazer em website asp.net ? tem alguma diferença para a consola C# ? é porque eu faço tal e qual como tu e quando compilo o website ele dá erro ao abrir a página 😕 Ou seja no IDE está tudo muito bem nem da warnings, quando compilo a abro a página no browser ele dispara logo o erro 😕 http://img267.imageshack.us/img267/5259/84713955.png Link to comment Share on other sites More sharing options...
pikax Posted August 29, 2012 at 01:51 PM Report Share #473973 Posted August 29, 2012 at 01:51 PM ve se isto te ajuda http://stackoverflow.com/questions/4299489/cs0012-the-type-system-data-linq-datacontext-is-defined-in-an-assembly-that-i Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender. A beleza de um código está em decompor problemas complexos em pequenos blocos simples. "learn how to do it manually first, then use the wizzy tool to save time." "Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast." Link to comment Share on other sites More sharing options...
nunolevezinho Posted August 29, 2012 at 08:24 PM Author Report Share #474009 Posted August 29, 2012 at 08:24 PM Ok após umas boas horas de pesquisa descobri que era um bug do VS2012 em que é necessário criar o objecto Linq2SQL na pasta App_Code. Caso contrário ele não cria o designer e nunca fica acessível. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now