Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
G

gamer1127

@gamer1127
About
Posts
84
Topics
33
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Code Analysis
    G gamer1127

    Hi. I have a java code and i want to get its running time or complexity analysis. can anyone suggest a software that does those things? I am using MATLAB for now but having difficulty using it.

    Do you like reading poems? I also write poems aside from C# codes. :) feel free to visit this site: http://www.poemscomputerstutorials.co.cc

    Java csharp java algorithms question

  • Retrieving data from an access database and show it to the user.
    G gamer1127

    Hi, I'm having a problem retrieving a data from an access database and put it into a textbox. I tried to code it but it didn't worked. here's my code:

    function search()
    {
    try{
    var connection = new ActiveXObject("ADODB.Connection");

    var rs = new ActiveXObject("ADODB.Recordset");

    connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\IT114P\\Week2-Hibaler\\regform.mdb");

    rs.Open("select emailAddress from RegFormTable where emailAddress = '"+document.regpage.emaildelete.value+"';", connection);

    rs.MoveFirst;
    while(!rs.eof)
    {
    document.regpage.email.value = rs.fields(0);
    rs.MoveNext;

    }
    rs.close;
    conec
    }
    catch(e)
    {
    alert(e);
    }
    }

    When I use this code I always get an ObjectError message. I don't know where or what's the problem with the code. Can anyone help me?

    JavaScript help database question

  • Backing up database file using SMO error
    G gamer1127

    Hi. I'm having problem with the way I Backup my database. I'm trying to use the SMO now because the first time I tried to backup my database with File.Copy() is I always have errors with the .dbo file that I'm backing up. I always have the error that the file is currently used by another process even if I already closed the connection. Now I'm still having problem with SMO. I encountered a run-time error saying: "the backup failed for the server ROJAI-PC". I don't know how to resolve the problem since I'm new to SMO. Can anyone help me? Here is the code I used:

    private void createBackupToolStripMenuItem_Click(object sender, EventArgs e)
    {
    Server srver = new Server();
    Backup bckup = new Backup();

            bckup.Devices.AddDevice(@"C:\\Documents and Settings\\Jairo Hibaler\\Desktop\\Backup\\MP\\HotelReservationSystem\\HotelReservationSystem\\bin\\Debug\\hotelReservationBackup.bak", DeviceType.File);
            bckup.Database = "HotelReservationDB";
            bckup.Action = BackupActionType.Database;
            bckup.Initialize = true;
            bckup.PercentCompleteNotification = 10;
            bckup.PercentComplete += new PercentCompleteEventHandler(bckup\_PercentComplete);
            bckup.SqlBackup(srver);
        }
    
        private void bckup\_PercentComplete(object sender, PercentCompleteEventArgs e)
        {
            MessageBox.Show(e.Percent.ToString() + "% backed up");
        }
    
    C# help database sysadmin debugging tutorial

  • Searching database for every keyboard press
    G gamer1127

    Hello to all. I'm having a little problem with one of the features that I want to have in my program. I want my program to search the names of the guest for every key press. For example, if I press H on the keyboard, all of the last names that starts with H should appear. I tried to use both KeyDown and KeyPress Events but either of them doesn't seem to work. Can anyone help me?

    C# help database algorithms tutorial question

  • Dragging a control from one panel to another panel
    G gamer1127

    Hi. I'm creating a program that would allow a user to drag a picturebox that is contained inside a panel and drop it into another panel. My problem is I don't know how to drag the picturebox over to the other panel. I already know how to drag a picturebox using mousedown, mousemove and mouseup events. This is the only problem that keeps me from keep on coding the program..please help..

    C# help tutorial

  • Transferring Focus to Multiple Buttons
    G gamer1127

    Hi. We're having a little problem in allowing the user click/press any button from a group of buttons inside a panel. What we want is after clicking/pressing one button that is not one of the group of buttons, the user will be allowed to click/press any of the buttons in the panel. All the buttons inside the panel represent the alphabet that's why we want to do that. The button that will be clicked before doing that is a start button. So can anyone help us?

    C# help question

  • Showing data from a database to a listbox during runtime
    G gamer1127

    ok. i understand now. i'll just transfer the code to a method (which didn't occured to me a while ago). what i first thought is if i put the code inside the method of the listbox the database will be opened once i clicked the listbox and since i need the data to be in the listbox before i click the listbox it will be too late so i put it in the constructor which i think is the best place because once the method of the form has ran the database will be open until i close the form.

    C# help database question

  • Showing data from a database to a listbox during runtime
    G gamer1127

    I declared the variable prog as global and used it to assign the value "CS" when the user has clicked the radio button. it is goes like this:

    private void rdioProgCS_CheckedChanged(object sender, EventArgs e)
    {
    prog = "CS";
    rdioProgCS.Enabled = false;
    rdioProgIT.Enabled = false;
    }

    C# help database question

  • Showing data from a database to a listbox during runtime
    G gamer1127

    there's no data in the listbox that it supposed to show.

    C# help database question

  • Showing data from a database to a listbox during runtime
    G gamer1127

    Hi. I'm having problems in showing all the data to a listbox. all of the data will be coming from a database and will be shown depending on the choices of the user. i tried to code it but it didn't work. here's my code:

    public frmMainForm()
    {
    InitializeComponent();
    string sConnection = "Provider = Microsoft.Jet.OLEDB.4.0;" + "Data Source = Schedule.mdb";

            using (OleDbConnection dbConnect = new OleDbConnection(sConnection))
            {
                dbConnect.Open();
    
                if (prog == "CS")
                {
                    string sqlString = "SELECT cs\_firstcourse, cs\_secondcourse, cs\_thirdcourse, cs\_fourthcourse, cs\_fifthcourse, cs\_sixthcourse, cs\_seventhcourse, cs\_eighthcourse, cs\_ninthcourse FROM CS WHERE cs\_year = @chosenYear AND cs\_term = @chosenTerm;";
    
                    OleDbCommand dbCmd = new OleDbCommand();
                    dbCmd.CommandText = sqlString;
                    dbCmd.Connection = dbConnect;
                    dbCmd.Parameters.AddWithValue("chosenYear", chosenYear);
                    dbCmd.Parameters.AddWithValue("chosenTerm", choseTerm);
    
                    using (OleDbDataReader dbReader = dbCmd.ExecuteReader())
                    {
                        if (dbReader.Read() == true)
                        {
                            for (int a = 0; a < 9; a++)
                            {
                                lstBoxCourses.Items.Add(dbReader\[a\].ToString());
                            }
                        }
                        else
                        {
                            MessageBox.Show("An error has occured while trying to retrieve data from the database", "Class Scheduling: Database Access Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        dbReader.Close();
                    }
                }
                dbConnect.Close();
            }
        }
    

    can someone help me?

    C# help database question

  • OleDbException
    G gamer1127

    Ok. Thanks for your answer. :)

    C# database question

  • OleDbException
    G gamer1127

    I just want to ask what are some of the errors that OleDbException exception handler usually handles? is the scenario of having a failed connection to the database one of the errors? I can't find a detailed list of all the exception handlers usually used in database programming.

    C# database question

  • Transferring focus from a textbox to a button
    G gamer1127

    Alright. Thanks for your answers. I think it will really help me a lot. :)

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    With all the things you pointed out, it means that I have to learn a lot of things when it comes to programming with relational database. :( Have to start reading all the ebooks that i got. We just started discussing programming with database and we already have a project that has it.

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    Ok. I'll try using this one and see if it works. :)

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    Now I have a new problem. Whenever I click the Log-In button it doesn't show an error message even if there's no entered data or the entered username and passwords are both wrong. It just do the event of logging in if both the username and passwords are correct. The username and password are saved in an MS Access database and i used SELECT query to check if both exists. Here is the code to clearly understand:

    string sConnection = "Provider = Microsoft.Jet.OLEDB.4.0;" + "Data Source = Schedule.mdb";

            try
            {
                OleDbConnection dbConnect = new OleDbConnection(sConnection);
                dbConnect.Open();
    
                string sqlString = "SELECT \* FROM LogIn WHERE ID = '" + txtBoxLogIn.Text + "' AND Password = '" + txtBoxPassword.Text + "';";
    
                OleDbCommand dbCmd = new OleDbCommand();
                dbCmd.CommandText = sqlString;
                dbCmd.Connection = dbConnect;
    
                OleDbDataReader dbReader;
                dbReader = dbCmd.ExecuteReader();
    
                while (dbReader.Read())
                {
                    if (dbReader\[0\].ToString() == txtBoxLogIn.Text && dbReader\[1\].ToString() == txtBoxPassword.Text )
                    {
                        frmMainForm frmMainForm = new frmMainForm();
                        frmMainForm.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Either the Username or Password does not exist", "Log-In Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    }
                }
                
                dbReader.Close();
                dbConnect.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return;
            }
    

    Did I do something wrong?

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    Your right about that. It is indeed the source of the problem. Thanks for that. :)

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    Jimmanuel wrote:

    Why? Have you tried separate handlers for each control?

    I just thought of applying the concept of having controls tagged to only one event-handler if they will have the same behavior. If that is the case, then i'll try using one event-handler for each control.

    C# help question

  • Transferring focus from a textbox to a button
    G gamer1127

    Hi. I'm having a problem with focusing from textbox to a button. Is there a way in doing this? I tried coding it but it doesn't work. Here's my code so far: The textbox:

    private void txtBoxLogIn_TextChanged(object sender, EventArgs e)
    {
    txtBoxLogIn.KeyPress += new KeyPressEventHandler(txtBoxLogIn_KeyPress);
    }

    and the eventhandler:

    private void txtBoxLogIn_KeyPress(object sender, KeyPressEventArgs e)
    {

      if (e.KeyChar == (char)Keys.Enter)
      {
          txtBoxPassword.Focus();
      }
      else if (e.KeyChar == (char)Keys.Enter && txtBoxPassword.Focused == true)
      {
          btnProceedLogIn.Focus();
      }
    

    }

    I'll be using only one eventhandler in transferring focus to other controls.

    C# help question

  • C# books
    G gamer1127

    if I buy a book about sql server, will i be able to use the sql queries presented in that book to ms access?

    C# database csharp sql-server sysadmin question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups