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
Rupesh N
NA
380
46.9k
return multiple values in public string method
Mar 22 2021 7:46 AM
public
string
post(login lg) {
try
{
query here
return
(particular user data here)
}
catch
(){
throw
;
}
}
I am using web API controller
my code:
public
string
Post(login lg)
{
List<login> log =
new
List<login>();
try
{
string
query = @
"select email,upassword,status,userid from signup where email='"
+ lg.email +
"' and upassword='"
+ lg.upassword +
"' and status=1"
;
DataTable dt =
null
;
using
(SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"rhymeDB"
].ConnectionString))
using
(SqlCommand cmd =
new
SqlCommand(query, con))
using
(SqlDataAdapter da =
new
SqlDataAdapter(cmd))
{
DataSet ds =
new
DataSet();
da.Fill(ds);
if
(ds.Tables.Count > 0)
{
dt = ds.Tables[0];
}
if
(dt.Rows.Count > 0)
{
login lgg =
new
login();
lgg.email = dt.Rows[0][
"email"
].ToString();
lgg.userid = dt.Rows[0][
"userid"
].ToString();
log.Add(lgg);
return
???
}
else
{
return
"invalid"
;
}
}
}
catch
(Exception ex)
{
return
ex.ToString();
}
}
Reply
Answers (
2
)
How do you create a custom AuthorizeAttribute in ASP.NET Core?
single and multiple Image upload