Dim sTempTable As String = sUserName & "ItemsDetail" Try If TableExists(sTempTable) Then Dim comm As New MySqlCommand("DROP TABLE " & sTempTable, con) If con.State = ConnectionState.Closed Then con.Open() End If comm.ExecuteNonQuery() con.Close() End If If con.State = ConnectionState.Closed Then con.Open() 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.ExecuteNonQuery() 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") Finally con.Close() End Try
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE