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
manjula d
NA
172
139.9k
using linq query to select count
Sep 12 2013 7:34 AM
how to write the below code using Linq query
string str = "select Vendor_Id,UserName,count(*) from tblvendor where UserName='" + txt_UserName.Text + "'and BINARY Password='" + txt_Password.Text + "'";
MySqlCommand cmd = new MySqlCommand(str, con);
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
VendorId = Convert.ToInt32(dr["Vendor_Id"]);
Session["vendorusername"] = dr["UserName"].ToString();
UserName = dr["UserName"].ToString();
Session["vusername"] = UserName;
}
}
i wrote like this:
var objUserLogin =(from objsel in objEntity.tblvendor where objsel.UserName == txt_UserName.Text && objsel.Password == txt_Password.Text select new { objsel.Vendor_Id, objsel.UserName }).Count();
if(objUserLogin > 0)
{
here table fields are not able to responding pls help me how to get thease table fields.
}
Reply
Answers (
2
)
Do not geting all from both table in linq to sql reporting ?
how to convert sql of this query to LINQ