Julio Motol Julio Motol - 1 year ago 74
C# Question

retrieve single data from a database with linq to sql

i have a table that goes like this.

CREATE TABLE [dbo].[loginInfos] (
[loginId] INT IDENTITY (1, 1) NOT NULL,
[username] VARCHAR (50) NULL,
[password] VARCHAR (50) NULL,

now i want to get the username and compare it with a input from a textbox. it will really be a huge help.

Answer Source
var MyDb = new MyDb ("c:\\Data\\MyDb .mdf");

var user = =
from u in MyDb.loginInfos
where u.username== txtUsername.Text
select u;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download