Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
C# code failing to pick user and password from access data
Tchala B
May 16 2017 10:13 AM
229
Reply
I have a windows forms application using ms access database but am having some issue with my login form. When i try to login the code can`t log me in after i input the right password and user name and am wondering what the problem might be
Here is my code
DataSet ds = GetData.getInfo(
"select * from Users where UserName='"
+ txt1 +
"' and Pswd1='"
+ txt2 +
"'"
,
"Users"
);
if
(info.Tables[0].Rows.Count > 0)
{
if
(info.Tables[0].Rows[0][2].ToString() == txt2)
{
getSettings.SessionId =
this
.cmbSession.SelectedIndex;
getSettings.Session =
this
.cmbSession.Text;
if
(!
string
.IsNullOrEmpty(info.Tables[0].Rows[0][
"Role_Id"
].ToString()))
{
getSettings.UserRoleId = Convert.ToInt32(info.Tables[0].Rows[0][
"Role_Id"
]);
getSettings.UserRole =
this
.GetData.getInfo(
"SELECT Role FROM Role_Master WHERE Role_Id="
+ (
object
)getSettings.UserRoleId);
}
this
.DialogResult = DialogResult.OK;
this
.Close();
}
Here is the Users Table
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
c# Automatically generate unit test code
How do I display thumbnail of pdf and doc file which I have