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
xxghostxx tak
NA
3
3.8k
how to check if user exist in oracle db using c# forms?
Dec 21 2013 9:33 AM
hi all
I just create two c# forums one for users to register and the second one for users to login into third forums to for example I want to know how to do this ?
I tried to do it by creating this method ,but its not working
public bool isUserExist(string un, string password)
{
bool status = false;
try
{
string connstring = "data source=test_db;user id=system;password=password;";
string statementcmd = "SELECT uname FROM register_user Where uname=@un";
using (OracleConnection conn = new OracleConnection(connstring))
{
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = conn;
cmd.Parameters.Add("@un", un);
cmd.CommandText = statementcmd;
if (conn.State != ConnectionState.Open)
{
conn.Open();
OracleDataReader reader = cmd.ExecuteReader();
if (!reader.Read())
MessageBox.Show("User Name Not Found");
if (!password.Equals(reader["password"].ToString()))
{
status = true;
MessageBox.Show("Incorrect Password");
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
status = false;
}
return status;
}
Reply
Answers (
3
)
tree view structure
Illustration about Transferring a File