2
Reply

Two buttons: "Back" and "Next"

Mfwamba Tshimanga

Mfwamba Tshimanga

Feb 4 2015 10:33 AM
624
Hi!


I need to scroll my datas with these buttons ("Back" and "Next"). With these codes how can I scrolling my datas showing on my textboxes.


conn = new OleDbConnection(connstr);
            comm = new OleDbCommand();
            conn.Open();

            OleDbParameter date = new OleDbParameter("@date", SqlDbType.VarChar);
            OleDbParameter cod = new OleDbParameter("@cod", SqlDbType.VarChar);
            OleDbParameter name = new OleDbParameter("@name", SqlDbType.VarChar);            

            comm.Parameters.Add(date);
            comm.Parameters.Add(cod);
            comm.Parameters.Add(name);

            date.Value = dateTimePicker2.Text;
            cod.Value = txtCode.Text;
            name.Value = txtWork.Text;            

            comm.Connection = conn;
            comm.CommandText = "insert into power ([date],[cod],[name]) values(@date,@cod,@name)";
            
            try
            {
                comm.ExecuteNonQuery();
                MessageBox.Show("Saved...");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();

Answers (2)