Hi, i need to get a users password from my database. I ask the user to enter his username in my textbox called txtUsername and his password in txtPassword. Then I try to use LinQ to sql to get the password. My Code: [CODE]public string GetPasswordHash() { var varPasswordHash = (from m in dataContext.Members where m.username == txtUsername.Text select m.password); string passwordHash = Convert.ToString(varPasswordHash); lblBasehash.Text = passwordHash; return passwordHash; }[/CODE] But this method only returns this: SELECT [t0].[password] FROM [dbo].[Members] AS [t0] WHERE [t0].[username] = @p0

Member Avatar
+0 forum 0

[CODE] private void displayWith1Criteria(string column, string value) { Console.WriteLine("entering _1_ display method"); dbcontent = new DBtestEntities(); var studienummerQuery = from members in dbcontent.Medlemmer.Include("Retninger") where column == value orderby members.Fornavn select new { Studienr = members.Studienummer, Fornavn = members.Fornavn, Efternavn = members.Efternavn, Email = members.Email, Studiested = members.Studiested, Betaling = members.BetalingsType, Uddannelses_Retning = members.Retninger.retningNavn }; dataGridView1.DataSource = studienummerQuery; } [/CODE] Doesnt return any data at all... column is being called with members.Fornavn (Fornavn = a column name) value = Anders (one of the data's in Fornavn column)

Member Avatar
Member Avatar
+0 forum 4

[CODE] var studienummerQuery = from members in dbcontent.Medlemmer.Include("Retninger") orderby members.Fornavn select members; foreach(var a in studienummerQuery) { Console.WriteLine(a); } [/CODE] Thats my code, wonder why it doesnt work.. My tables are: Medlemmer Retninger

Member Avatar
Member Avatar
+0 forum 3

hi there, i have a question in LINQ in C#, i have a webpage and in that i have a button called clicl and theGridview . i have a LINQ to SQL class with the Employee and the USErLogin which the EID in the Employee calss is a foreign key in the USerlogin class, i doubled click on the button and wrote a simple query to get the values from the Employee table below is the code [CODE] protected void Button1_Click(object sender, EventArgs e) { var query = from e2 in po.Employees select e2; GridView1.DataBind(); GridView1.DataSource = query; } [/CODE] …

Member Avatar
Member Avatar
+0 forum 5

i have a employee class and a userlogin class in the mdf file. there is an foreign key between the employee and the userlogin tables. the EID in the Employee class is in the uesrlogin class which is a foreign key in the userlogin. but when i try to access the EID in the userlogin class it dosen't have that option.... i wrote the query below, this is not working [CODE] var a = from b in po.Employees where b.UserLogins.[B]EID[/B](here the EID dosn't show up) select b; [/CODE] please can some one help this out but this is working [CODE] …

Member Avatar
+0 forum 0

I'm totally new to this, as will be evident, and I can't figure out the syntax for what should be the most basic code. I'm just trying to get a piece of data from a SQL database and store it in a variable. From various book and websites, I cobbled together the mess below. What I'm attempting (using LINQ to SQL) is to get a value from the "Password" field of a database, and compare it to a string entered into a text box web control: [code=c#] string LoginName = Login_TextBox.Text; string PasswordString = Password_Textbox.Text; using (Link2StoryListDataContext db = new …

Member Avatar
Member Avatar
+0 forum 2

Hello, I am currently working on a project for my degree using asp.net, C# and Sql. The problem I am having is with my connection.cs file that I have created, the code I have is as follows: [CODE] using System; using System.Configuration; using System.Linq; using System.Data.Linq; using System.Xml; using School.SchoolCore.Core.Domain; using School.SchoolCore.Properties; using StructureMap; namespace School.SchoolCore.Core.DataAccess.Impl { public class Connection { public SchoolDataContext GetContext() { string connString = ""; try { XmlDocument doc = new XmlDocument(); doc.Load("ConnectionStringToUse.xml"); XmlNodeList xnl = doc.GetElementsByTagName("environment"); XmlElement xe = (XmlElement) xnl[0]; switch (xe.InnerText.ToString().ToLower()) { case "local": connString = Settings.Default.SchoolConnectionStringLocal; break; case "development": connString = Settings.Default.SchoolConnectionStringDevelopment; …

Member Avatar
Member Avatar
+0 forum 2

hi to all, I am trying to use MVC. I am using simple Login view. I just want to implement login form for my users. firstly I created database User and in that table 'login' with fields id, name, pass. I add values inn that. I create controller Search==> [code] public ActionResult search(FormCollection form) { //to check out I am checking with id field var id = Int32.Parse(form["name"]); ViewData.Model = u.login.First(m => m.id == id); return View(); } [/code] then i create view ==> [code] <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> search </asp:Content> <asp:Content ID="Content2" …

Member Avatar
Member Avatar
+0 forum 1

The End.