I had c# application that has registration form and another from that user use to sigin in into my application
i wonder how to check if user its register or not

my login form has to textbox username and passpwrd

and im trying this code i gusse its wrong can anyone help me to get through it ?

        public void isUserExist()
        {
            try
            {
                string connstring = "data source=test_db;user id=system;password=password;";
                string statementcmd = "SELECT * FROM register_user Where UserName=@username";
                string username = "";
                string password = "";

                OracleConnection conn = new OracleConnection(connstring);
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = statementcmd;
                cmd.Parameters.Add("@username", username);
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                    OracleDataReader reader = cmd.ExecuteReader();

                   if (!reader.HasRows)
                   { MessageBox.Show("User Name Not Found"); }

                   if (!password.Equals(reader["password"].ToString()))
                        MessageBox.Show("Incorrect Password");
                    reader.Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

        }

Code update please take a look

        private void button1_Click(object sender, EventArgs e)
        {
            isUserExist(textBox1.Text,textBox2.Text);
        }

        public bool isUserExist(string username,string password)
        {
            try
            {
                string connstring = "data source=test_db;user id=system;password=password;";
                string statementcmd = "SELECT * FROM register_user Where UserName=@username";

                OracleConnection conn = new OracleConnection(connstring);
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = statementcmd;
                cmd.Parameters.Add("@username", username);
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                    OracleDataReader reader = cmd.ExecuteReader();

                   if (!reader.HasRows)
                   { MessageBox.Show("User Name Not Found"); }

                   if (!password.Equals(reader["password"].ToString()))
                        MessageBox.Show("Incorrect Password");
                    reader.Close();
                }
                return true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }

        }
    }

error message ora-00936 missing expression

so anyone can help guys ?

Okay so I am no expert in this (heck I am referencing a code someone else wrote at my work), but I have a few questions.

First of all, what line is it breaking on? Also, does the ConnectionString need to be case-sensative (I know SQL doesn't, but that's for queries)

Also have you looked at this?
http://www.techonthenet.com/oracle/errors/ora00936.php

Explain exactly what that error message means (might want to make sure the table and column name are correct)

@Ange1ofD4rkness thank u man i did alot resech b4 posting here..
anyone can help guys ???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.