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
Thanks ... Ed