troubleshooting Question

MySQL TINYINT(1) error

Avatar of pigparent
pigparent asked on
Visual Basic ClassicMySQL Server
3 Comments1 Solution769 ViewsLast Modified:
I am converting my application from using an Access backend to MySQL.  I am having to doctor some SQL statements here and there.  The one that has stumped me is in the snippet below.  I am trying to append a few records to a ew temporary table.  The value for the column "Reviewed" is -1 for the first record and zero for the second.  The error I keep getting is, "Out of range value adjusted for column 'Reviewed' at row 1".  Can you help me?
Dim sTempTable As String = sUserName & "ItemsDetail"
            If TableExists(sTempTable) Then
                Dim comm As New MySqlCommand("DROP TABLE " & sTempTable, con)
                If con.State = ConnectionState.Closed Then
                End If
            End If
            If con.State = ConnectionState.Closed Then
            End If
            Dim cmd As New MySqlCommand("CREATE TABLE invoicesdata." & sTempTable & " (PONo VARCHAR(50) NOT NULL, InvNo VARCHAR(50) NOT NULL, LineNo SMALLINT(5) UNSIGNED NOT NULL, EncumbrChange DOUBLE(15,5) NOT NULL, InvDate DATETIME NOT NULL, ProcessDate DATETIME NOT NULL, Reviewed TINYINT(1) UNSIGNED NOT NULL, Posted TINYINT(1) UNSIGNED NOT NULL) ENGINE = InnoDB", con)
            cmd = New MySqlCommand("INSERT INTO invoicesdata." & sTempTable & " (PONo, InvNo, LineNo, EncumbrChange, InvDate, ProcessDate, Reviewed, Posted) SELECT Invoices.PONo, Invoices.InvNo, Invoices.ItemsLine AS LineNo, -InvoiceAmt AS EncumbrChange, Invoices.InvDate, Invoices.ProcessDate, Invoices.Reviewed, Invoices.Posted FROM(Invoices) WHERE (((Invoices.PONo)='" & sPONoPassed & "') AND ((Invoices.Exhibit)=0))", con)
            cmd.ExecuteNonQuery() '<-----this line throws the error
        Catch dbex As MySqlException
            MessageBox.Show("Cannot connect to the database.  Check the network status and try again.", "Data access error")
        End Try
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros