"Error on executing DbCommand."

"Error on executing DbCommand."

Postby edstaffin » Wed 30 Jun 2010 13:40

Talk about a useless error message!
I am writing some pretty simple linq code to do an insert of a couple of records into an oracle database using dotConnect. However, when I do the db.submitChanges it blows up with "Error on executing DbCommand."

Code: Select all
        Try

            Dim db As New CommonDBContext
            Using oScope As New TransactionScope
                Dim oUser As New User

                With oUser
                    .Address_1 = txtAddress1.Text
                    .Address_2 = txtAddress2.Text
                    .Address_3 = txtAddress3.Text
                    .City = txtCity.Text
                    .State_Code = ddlState.SelectedValue
                    .Country_Code = ddlCountry.SelectedValue
                    If ddlCountry.SelectedValue = "US" Then
                        .County_Code = ddlCounty.SelectedValue
                    Else
                        .County_Code = ""
                    End If
                    .Postal_Code = txtZip.Text
                    .Company_Name = txtCompany.Text
                    .Email_Address = txtEmail.Text
                    .First_Name = txtFirstName.Text
                    .Last_Name = txtLastName.Text
                    .Middle_Name = txtMiddle.Text
                    .Ldap_Account = sLdap
                    .Work_Phone = txtWorkPhone.Text
                    .Mobile_Phone = txtMobilePhone.Text
                    .Fax_Number = txtFax.Text
                    .State_Name = ddlState.SelectedItem.Text
                    If ddlCountry.SelectedValue = "US" Then
                        .County_Name = ddlCounty.SelectedItem.Text
                    Else
                        .County_Name = ""
                    End If
                    .Modified_By = sLdap
                    .Modified_Date = Now
                    .Is_Active = True
                    .Created_By = sLdap
                    .Created_Date = Now
                End With
                db.Users.InsertOnSubmit(oUser)
                db.SubmitChanges()
                Dim oAUR As New App_User_Role
                With oAUR
                    .App_Name = ConfigConstants.GC_APP_NAME
                    .Role_Code = 3 ' requester
                    .Ldap_Account = sLdap
                End With
                db.App_User_Roles.InsertOnSubmit(oAUR)
                db.SubmitChanges()
                oScope.Complete()
            End Using
        Catch ex As Exception
            ErrorLog.Handle_Error(ex)
        End Try


Pretty simple, huh? Anyone with any ideas? I sure could use the help.
Thanks ... Ed
edstaffin
 
Posts: 43
Joined: Mon 13 Oct 2008 13:23

Postby Shalex » Wed 30 Jun 2010 14:49

1. Please post here the content of the InnerException and StackTrace properties of the exception object (click View Details in the pop-up window when the error occurs).
2. Check the query via dbMonitor (download link, documentation).
Shalex
Devart Team
 
Posts: 7538
Joined: Thu 14 Aug 2008 12:44

You da man

Postby edstaffin » Wed 30 Jun 2010 15:59

It didn't occur to me to look at the inner exception. Once I looked there I was able to figure out the problem. That dbMonitor looks cool too.
Thanks again!
edstaffin
 
Posts: 43
Joined: Mon 13 Oct 2008 13:23


Return to dotConnect for Oracle