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
Edison Augusthy
NA
52
6.7k
not passing values
Oct 27 2016 1:39 AM
i was trying to create a simple service for login. but the value is not getting in respository class. i think i miss some code..can anyone help me ..? thanks in advance.
here is my code for controller
static
LoginRespository repository =
new
LoginRespository();
public
string AddEmployees(Login Emp)
{
var response = repository.AddEmployees(Emp);
return
response;
}
and respository class here
public
string AddEmployees(Login Emp)
{
SqlCommand com;
SqlConnection con =
new
SqlConnection(@
"Data Source=DOTNET;Initial Catalog=edin;Integrated Security=True;Pooling=False"
);
try
{
com =
new
SqlCommand(
"select * from data where name='"
+ Emp.username +
"'"
, con);
con.Open();
SqlDataReader dr = com.ExecuteReader();
if
(dr.HasRows)
{
return
"success"
;
}
else
{
return
"error"
;
}
con.Close();
}
catch
(Exception aa)
{
return
aa.ToString();
}
}
and my model class
public
string username { get; set; }
public
string password { get; set; }
can anyone tell what mistake i have made..
Reply
Answers (
2
)
Compare date only and find the difference
Add string to xml file at the beginning