hi guys,

i have start working with C#, i m making a simple application for my office, i m using mysql database. my question is i want to make a record navigation button like: Next, Previous ..... kindly guide me how to make this. i m using mysql database with mysqlconnector. i hope someone reply me correctly.

i have repeate my post with code this time.

private void btnNext_Click(object sender, EventArgs e)
            string myConnection = "datasource=localhost;port=3306;username=root";
            MySqlConnection myconn = new MySqlConnection(myConnection);
            MySqlCommand com = new MySqlCommand("select count(id) from dbcj.kartype", myconn);

            MySqlDataAdapter dataAdapter = new MySqlDataAdapter("SELECT type FROM dbcj.kartype", myconn);
            DataSet dataSet = new DataSet();

            object count = com.ExecuteScalar();
            int counter = Convert.ToInt32(count);
            if (count != null)
                int i = 1;
                while (i > counter)
                    typeBox.Text = dataSet.Tables[0].Rows[i]["type"].ToString();

                foreach (string ii in counter.ToString())
                    typeBox.Text = dataSet.Tables[0].Rows[i]["type"].ToString();
2 Years
Discussion Span
Last Post by TekknoDraykko

Hello kamran815! :)
It looks like you're using ADO.NET to connect to your data stored (i.e. mysql). Is that an absolute must or are you open to using LINQ? The LINQ methods have simplified access to data from RDBMS. Take a look at this tutorial if you're not familiar with it: https://msdn.microsoft.com/en-us/data/ff728653.aspx

Let me know if you have any questions:



Hello again kamran815...
Looking over your code, it looks like you're planning to scroll through each record one by one. I'm not certain what your requirements and specs are for this application, but if you just need to pull up records, and say, access them for editing, you might try using the GridView control, and a Master/Detail pattern. You can learn more about this at: https://msdn.microsoft.com/en-us/library/aa581795.aspx


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.