This is a multi-part message in MIME format.
------=_NextPart_000_0074_01C5F40F.2ADFBD40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi All,
I have a typed dataset which contains several tables. The 3 that I am =
experiencing difficulty with are "CONTACTS", "ALL_ZIP_CODES" and =
"E_ZIP_CODES." The "CONTACTS" table is selfexplantory. The table =
"E_ZIP_CODES" is a subset of all ZIP codes that are in the "CONTACTS" =
table. The table "ALL_ZIP_CODES" consists of a complete listing of ZIP =
codes.
What I am trying to do is, when a user updates or adds a new contact, I =
search for the ZIP code in the "E_ZIP_CODES" table (dvSearch below). If =
the ZIP code is not in the table "E_ZIP_CODES" (i =3D -1 below), I want =
to add the ZIP code and city values from the "ALL_ZIP_CODES" datatable =
to the datatable "E_ZIP_CODES" so that I can update the "CONTACTS" table =
with the newly selected ZIP code. The new record is added to the =
datatable and all appears to be fine. However, when I try to update the =
"CONTACTS" datatable, I get the error "Failed to enable constraints"
TIA,
Vince
' Code to add new ZIP code
Dim dv As New DataView
Dim strSearch As String, i As Integer
With dv
.Table =3D dsMulti.Tables("ALL_ZIP_CODES")
.Sort =3D "ZIP_CODE"
.RowStateFilter =3D DataViewRowState.CurrentRows
End With
=20
strSearch =3D cboE_ZIP_Code.Text.ToString
If strSearch =3D "" Then strSearch =3D txtE_ZIP_Code.Text.ToString
Try
Dim dvSearch As New DataView
With dvSearch
.Table =3D dsMulti.Tables("E_ZIP_CODES")
.Sort =3D "ZIP_CODE"
.RowStateFilter =3D DataViewRowState.CurrentRows
End With
i =3D dvSearch.Find(strSearch)
If i =3D -1 Then
Dim strCity As String
With dv
.Table =3D dsMulti.Tables("ALL_ZIP_CODES")
.Sort =3D "ZIP_CODE"
.RowStateFilter =3D DataViewRowState.CurrentRows
End With
i =3D dv.Find(strSearch)
strCity =3D "Test"
Dim rowNew As DataRow
rowNew =3D dsMulti.Tables("E_ZIP_CODES").NewRow
rowNew("ZIP_CODE") =3D strSearch
rowNew("CITY") =3D strCity
dsMulti.Tables("E_ZIP_CODES").NewRow.BeginEdit()
dsMulti.Tables("E_ZIP_CODES").Rows.Add(rowNew)
dsMulti.Tables("E_ZIP_CODES").AcceptChanges()
End If
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
' Code to Update the CONTACTS table
sbrContacts.Panels(4).Text =3D "Saving record ..."
Try
curContacts.Refresh()
curContacts.EndCurrentEdit() ' Error here=20
With daContact.UpdateCommand
.Parameters("I_F_NAME").Value =3D txtFName.Text
.Parameters("I_M_NAME").Value =3D txtMI.Text
.Parameters("I_L_NAME").Value =3D txtLName.Text
.Parameters("I_CAOID").Value =3D cboCAO.ValueMember
.Parameters("I_LEVELID").Value =3D cboLevel.ValueMember
.Parameters("I_COMPANYID").Value =3D =
cboCompany.ValueMember
.Parameters("I_SITEID").Value =3D cboSite.ValueMember
.Parameters("I_SUB_TEAMID").Value =3D =
cboSubTeam.ValueMember
.Parameters("I_FUNCTIONID").Value =3D =
cboFunction.ValueMember
.Parameters("I_SUB_FUNCTIONID").Value =3D =
cboSubTeam_Function.ValueMember
.Parameters("I_SUB_FUNCTION_2_ID").Value =3D =
cboSubTeam_Function_2.ValueMember
.Parameters("I_POSITIONID").Value =3D =
cboPosition.ValueMember
.Parameters("I_BUS_PHONE").Value =3D txtBus_Phone.Text
.Parameters("I_BUS_PHONE_2").Value =3D =
txtBus_Phone_2.Text
.Parameters("I_BUS_MOBILE").Value =3D txtBus_Mobile.Text
.Parameters("I_BUS_OTHER").Value =3D txtBus_Other.Text
.Parameters("I_BUS_FAX").Value =3D txtBus_Fax.Text
.Parameters("I_BUS_FAX_2").Value =3D txtBus_Fax_2.Text
.Parameters("I_BUS_PAGER").Value =3D txtBus_Pager.Text
.Parameters("I_BUS_EMAIL").Value =3D txtBus_eMail.Text
.Parameters("I_NOTES").Value =3D txtNotes.Text
.Parameters("I_SSN").Value =3D txtSSN.Text
.Parameters("I_PAYROLL_NUM").Value =3D =
txtPayroll_Num.Text
.Parameters("I_GS_SERIES").Value =3D txtGS_Series.Text
.Parameters("I_GS_GRADE").Value =3D txtGS_Grade.Text
.Parameters("I_H_STREET_1").Value =3D txtH_Street_1.Text
.Parameters("I_H_STREET_2").Value =3D txtH_Street_2.Text
.Parameters("I_H_ZIP_CODE").Value =3D cboH_ZIP_Code.Text
.Parameters("I_H_PHONE").Value =3D txtH_Phone.Text
.Parameters("I_H_PHONE_2").Value =3D txtH_Phone_2.Text
.Parameters("I_H_MOBILE").Value =3D txtH_Mobile.Text
.Parameters("I_H_MOBILE_2").Value =3D txtH_Mobile_2.Text
.Parameters("I_H_PAGER").Value =3D txtH_Pager.Text
.Parameters("I_H_FAX").Value =3D txtH_Fax.Text
.Parameters("I_H_EMAIL").Value =3D txtH_eMail.Text
.Parameters("I_E_CONTACT").Value =3D txtE_Contact.Text
.Parameters("I_E_STREET").Value =3D txtE_Street.Text
.Parameters("I_E_STREET_2").Value =3D txtE_Street_2.Text
.Parameters("I_E_ZIP_CODE").Value =3D cboE_ZIP_Code.Text
.Parameters("I_E_PHONE").Value =3D txtE_Phone.Text
.Parameters("I_E_PHONE_2").Value =3D txtE_Phone_2.Text
.Parameters("I_E_PHONE_3").Value =3D txtE_Phone_3.Text
.Parameters("I_CONTACTID").Value =3D lblContactID.Text
End With
daContact.Update(dsMulti, "CONTACTS")
daContact.Fill(dsMulti, "CONTACTS")
sbrContacts.Panels(4).Text =3D "Ready"
Cursor.Current =3D System.Windows.Forms.Cursors.Default
Catch oraEX As OracleException
sbrContacts.Panels(4).Text =3D "Error"
Cursor.Current =3D System.Windows.Forms.Cursors.Default
MsgBox(oraEX.Message.ToString)
End Try
------=_NextPart_000_0074_01C5F40F.2ADFBD40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi All,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I have a typed dataset which contains =
several=20
tables. The 3 that I am experiencing difficulty with are "CONTACTS",=20
"ALL_ZIP_CODES" and "E_ZIP_CODES." The "CONTACTS" table is =
selfexplantory. The=20
table "E_ZIP_CODES" is a subset of all ZIP codes that are in the =
"CONTACTS"=20
table. The table "ALL_ZIP_CODES" consists of a complete listing of ZIP=20
codes.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>What I am trying to do is, when a user =
updates or=20
adds a new contact, I search for the ZIP code in the "E_ZIP_CODES" table =
(dvSearch below). If the ZIP code is not in the table "E_ZIP_CODES" (i =
=3D -1=20
below), I want to add the ZIP code and city values from the =
"ALL_ZIP_CODES"=20
datatable to the datatable "E_ZIP_CODES" so that I can update the =
"CONTACTS"=20
table with the newly selected ZIP code. The new record is added to the =
datatable=20
and all appears to be fine. However, when I try to update the "CONTACTS" =
datatable, I get the error "Failed to enable constraints"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>TIA,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Vince</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>' Code to add new ZIP code<BR>Dim dv As =
New=20
DataView<BR>Dim strSearch As String, i As Integer</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>With dv<BR> .Table =3D=20
dsMulti.Tables("ALL_ZIP_CODES")<BR> .Sort =3D=20
"ZIP_CODE"<BR> .RowStateFilter =3D =
DataViewRowState.CurrentRows<BR>End=20
With<BR> <BR>strSearch =3D=20
cboE_ZIP_Code.Text.ToString</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>If strSearch =3D "" Then strSearch =3D=20
txtE_ZIP_Code.Text.ToString</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Try<BR> Dim dvSearch As New=20
DataView<BR> With dvSearch<BR> .Table =3D=20
dsMulti.Tables("E_ZIP_CODES")<BR> &nbs=
p; =20
.Sort =3D=20
"ZIP_CODE"<BR>  =
; =20
.RowStateFilter =3D DataViewRowState.CurrentRows<BR> End =
With<BR> i =3D=20
dvSearch.Find(strSearch)<BR> If i =3D -1 Then<BR> =
Dim=20
strCity As String<BR> With dv<BR> =20
.Table =3D=20
dsMulti.Tables("ALL_ZIP_CODES")<BR> =
.Sort =3D=20
"ZIP_CODE"<BR> .RowStateFilter =3D=20
DataViewRowState.CurrentRows<BR> End=20
With<BR> i =3D =
dv.Find(strSearch)<BR> strCity=20
=3D "Test"<BR> Dim rowNew As =
DataRow<BR> =20
rowNew =3D dsMulti.Tables("E_ZIP_CODES").NewRow<BR> =20
rowNew("ZIP_CODE") =3D strSearch<BR> rowNew("CITY") =
=3D=20
strCity<BR> =20
dsMulti.Tables("E_ZIP_CODES").NewRow.BeginEdit()<BR> =20
dsMulti.Tables("E_ZIP_CODES").Rows.Add(rowNew)<BR> =20
dsMulti.Tables("E_ZIP_CODES").AcceptChanges()<BR>End If<BR>Catch ex As=20
Exception<BR> MsgBox(ex.Message.ToString)<BR>End Try</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>' Code to Update the CONTACTS=20
table<BR> sbrContacts.Panels(4).Text =
=3D=20
"Saving record ..."<BR>Try<BR> curContacts.Refresh()<BR><FONT=20
color=3D#ff0000> curContacts.EndCurrentEdit() ' Error=20
here </FONT><BR> With=20
daContact.UpdateCommand<BR> &nbs=
p; .Parameters("I_F_NAME")=
.Value=20
=3D=20
txtFName.Text<BR> &n=
bsp; =20
.Parameters("I_M_NAME").Value =3D=20
txtMI.Text<BR>  =
; =20
.Parameters("I_L_NAME").Value =3D=20
txtLName.Text<BR> &n=
bsp; =20
.Parameters("I_CAOID").Value =3D=20
cboCAO.ValueMember<BR> &nb=
sp; =20
.Parameters("I_LEVELID").Value =3D=20
cboLevel.ValueMember<BR> &=
nbsp; =20
.Parameters("I_COMPANYID").Value =3D=20
cboCompany.ValueMember<BR>  =
; =20
.Parameters("I_SITEID").Value =3D=20
cboSite.ValueMember<BR> &n=
bsp; =20
.Parameters("I_SUB_TEAMID").Value =3D=20
cboSubTeam.ValueMember<BR>  =
; =20
.Parameters("I_FUNCTIONID").Value =3D=20
cboFunction.ValueMember<BR> &nbs=
p; =20
.Parameters("I_SUB_FUNCTIONID").Value =3D=20
cboSubTeam_Function.ValueMember<BR> &n=
bsp; =20
.Parameters("I_SUB_FUNCTION_2_ID").Value =3D=20
cboSubTeam_Function_2.ValueMember<BR> =
=20
.Parameters("I_POSITIONID").Value =3D=20
cboPosition.ValueMember<BR> &nbs=
p; =20
.Parameters("I_BUS_PHONE").Value =3D=20
txtBus_Phone.Text<BR> &nbs=
p; =20
.Parameters("I_BUS_PHONE_2").Value =3D=20
txtBus_Phone_2.Text<BR> &n=
bsp; =20
.Parameters("I_BUS_MOBILE").Value =3D=20
txtBus_Mobile.Text<BR> &nb=
sp; =20
.Parameters("I_BUS_OTHER").Value =3D=20
txtBus_Other.Text<BR> &nbs=
p; =20
.Parameters("I_BUS_FAX").Value =3D=20
txtBus_Fax.Text<BR> =
=20
.Parameters("I_BUS_FAX_2").Value =3D=20
txtBus_Fax_2.Text<BR> &nbs=
p; =20
.Parameters("I_BUS_PAGER").Value =3D=20
txtBus_Pager.Text<BR> &nbs=
p; =20
.Parameters("I_BUS_EMAIL").Value =3D=20
txtBus_eMail.Text<BR> &nbs=
p; =20
.Parameters("I_NOTES").Value =3D=20
txtNotes.Text<BR> &n=
bsp; =20
.Parameters("I_SSN").Value =3D=20
txtSSN.Text<BR> &nbs=
p; =20
.Parameters("I_PAYROLL_NUM").Value =3D=20
txtPayroll_Num.Text<BR> &n=
bsp; =20
.Parameters("I_GS_SERIES").Value =3D=20
txtGS_Series.Text<BR> &nbs=
p; =20
.Parameters("I_GS_GRADE").Value =3D=20
txtGS_Grade.Text<BR>  =
; =20
.Parameters("I_H_STREET_1").Value =3D=20
txtH_Street_1.Text<BR> &nb=
sp; =20
.Parameters("I_H_STREET_2").Value =3D=20
txtH_Street_2.Text<BR> &nb=
sp; =20
.Parameters("I_H_ZIP_CODE").Value =3D=20
cboH_ZIP_Code.Text<BR> &nb=
sp; =20
.Parameters("I_H_PHONE").Value =3D=20
txtH_Phone.Text<BR> =
=20
.Parameters("I_H_PHONE_2").Value =3D=20
txtH_Phone_2.Text<BR> &nbs=
p; =20
.Parameters("I_H_MOBILE").Value =3D=20
txtH_Mobile.Text<BR>  =
; =20
.Parameters("I_H_MOBILE_2").Value =3D=20
txtH_Mobile_2.Text<BR> &nb=
sp; =20
.Parameters("I_H_PAGER").Value =3D=20
txtH_Pager.Text<BR> =
=20
.Parameters("I_H_FAX").Value =3D=20
txtH_Fax.Text<BR> &n=
bsp; =20
.Parameters("I_H_EMAIL").Value =3D=20
txtH_eMail.Text<BR> =
=20
.Parameters("I_E_CONTACT").Value =3D=20
txtE_Contact.Text<BR> &nbs=
p; =20
.Parameters("I_E_STREET").Value =3D=20
txtE_Street.Text<BR>  =
; =20
.Parameters("I_E_STREET_2").Value =3D=20
txtE_Street_2.Text<BR> &nb=
sp; =20
.Parameters("I_E_ZIP_CODE").Value =3D=20
cboE_ZIP_Code.Text<BR> &nb=
sp; =20
.Parameters("I_E_PHONE").Value =3D=20
txtE_Phone.Text<BR> =
=20
.Parameters("I_E_PHONE_2").Value =3D=20
txtE_Phone_2.Text<BR> &nbs=
p; =20
.Parameters("I_E_PHONE_3").Value =3D=20
txtE_Phone_3.Text<BR> &nbs=
p; =20
.Parameters("I_CONTACTID").Value =3D=20
lblContactID.Text<BR> &nbs=
p; =20
End =
With<BR>  =
;=20
daContact.Update(dsMulti,=20
"CONTACTS")<BR> &nbs=
p; =20
daContact.Fill(dsMulti,=20
"CONTACTS")<BR> &nbs=
p; =20
sbrContacts.Panels(4).Text =3D=20
"Ready"<BR> &n=
bsp;=20
Cursor.Current =3D System.Windows.Forms.Cursors.Default<BR>Catch oraEX =
As=20
OracleException<BR> sbrContacts.Panels(4).Text =3D=20
"Error"<BR> Cursor.Current =3D=20
System.Windows.Forms.Cursors.Default<BR> MsgBox(oraEX.Message.ToStri=
ng)<BR>End=20
Try<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_0074_01C5F40F.2ADFBD40--