Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How can i check for an existing attribute record before inserting ?
Maroun
Hi,
I am inserting custom1 values into a worksite database but would like to first check if the records being inserted allready exists. How can i go about this ?
this is the code i am using:
Dim dms As New IMANADMIN.NRTDMS
Dim sess As IMANADMIN.NRTSession
Dim db As INRTDatabase2
Sub ImportC1()
sess = dms.Sessions.Add("pp-dms-765434")
sess.Login("dmsadmin", "aps")
db = sess.Databases.Item(1)
Dim cn As New String("data source = au-marounm-nb; initial catalog = aps_int; user id = admin; pwd =; connect timeout = 50000")
Dim cns As New SqlConnection(cn)
cns.Open()
Dim cmd As String = ("select objinstid, cltsortname from cdbclient")
Dim ds As New Data.DataSet
Dim da As New SqlDataAdapter(cmd, cns)
Dim dt As New DataTable
da.Fill(ds, "Client")
da.Fill(dt)
For Each r As DataRow In dt.Rows
Try
db.InsertParentCustomField(AttributeID.nrCustom1, r(0).ToString, r(1).ToString, True)
Catch ex As Exception
MsgBox("Can't load" & vbCrLf & ex.Message)
End Try
Next
End Sub
Thanks for your help.
Find more posts tagged with
Comments
guido1
There's no need to hook directly into the database with SQL. You can reference the IManage COM library (IManage.DLL) and use the SearchCustomAttributes method on the IManDatabase object