0

I have created a c# windows form application using visual studio 2010, I would now like to create a setup exe file for my app, problem is, It requires a database to run, my question is how do i include this database in my setup.

I created the database using Oracle sql developer.

i am using a local connection ie. "System-XE"

Here is a code snippet of how the program communicates with the database.

            string oradb = "Data Source=localhost:1521/XE;User Id=system;Password=5853123;";

        OracleConnection conn = new OracleConnection(oradb);

        try
        {
            conn.Open();

            OracleCommand cmd = new OracleCommand();

            cmd.Connection = conn;
            cmd.CommandText = "SELECT username from administrators where password = " + textBox2.Text;
            cmd.CommandType = CommandType.Text;

            OracleDataReader dr = cmd.ExecuteReader();

            conn.Close();
            loggedIn = true;
            Close();
        }
        catch(Exception){
                MessageBox.Show("Incorrect Credentials, please try again.");
            }
        finally
        {
            if (conn.State == ConnectionState.Open)
            {
                conn.Close();
            }
        }


        loggedIn = true;
        Close();
2
  • Is that your real password? Time to change then... :) Commented Jun 1, 2013 at 16:22
  • its just a university project, not actually linked to anything but. Commented Jun 1, 2013 at 16:25

1 Answer 1

1

The most practical solution is to let the users install the database themselves and then just ask for a connection string during installation which you then put in your app.config.

It's easily done with WiX but I guess you can do it with ClickOnce as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.