Function sms_rpt.IDENT_CURRENT does not exit.

Hi i do encounter is error "Function sms_rpt.IDENT_CURRENT does not exit."


private void LastRowNo()
        {
            InitialRecord = LastRecord;

            string cmd = "Select IDENT_CURRENT('mastersmsdb')";
            myconint.Open();
            MySqlCommand checkcmd = new MySqlCommand(cmd, myconint);
            LastRecord = Convert.ToInt32(checkcmd.ExecuteScalar());                    // <--- error point over here.

            if (myconint.State == ConnectionState.Open)
                myconint.Close();

            lblSSNewRecord.Text = "New Incoming Record :" + Convert.ToString(LastRecord - InitialRecord );
            lblSSExistingRecord.Text = "Existing Record : " + Convert.ToString(InitialRecord );
Rama TitoProgrammerAsked:
Who is Participating?
 
johanntagleConnect With a Mentor Commented:
MySQL does not have an ident_current function.  If you are trying to get the auto-generated integer primary key of a just inserted row, see http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id.

However, it seems you just seem to want to get the last generated number for a table.  For this you just do a "select max(primary key column) from table".

Of course, this assumes you used the auto_increment feature (see http://dev.mysql.com/doc/refman/5.5/en/example-auto-increment.html)
0
All Courses

From novice to tech pro — start learning today.