Why can't I search for the table row I j

445
6
11-28-2023 09:22 AM
EricPfirman
New Contributor III

I open a table, create a new row and then search the table for that row, but can't find it. Why?

	Using tblAttachments As Table = gdb.OpenDataset(Of Table)("Attachments")
		Using rb As RowBuffer = tblAttachments.CreateRowBuffer()
			With rb
				.Item("ROWGUID") = ATTACH_GUID
				.Item("Filename") = Path.GetFileName(Filename)
				.Item("ATTACHMENT_BLOB") = buffer
				.Item("ATTACH_DATE") = File.GetCreationTime(Filename).ToShortDateString()
			End With
			Dim row As Row = tblAttachments.CreateRow(rb)
			row.Store()
			row.Dispose()
			row = Nothing
		End Using

		' Try a querydef here to see if we can see the record we just added
		Dim qf As New QueryFilter
		qf.WhereClause = "ROWGUID = '" + ATTACH_GUID + "'"
		Using rc As RowCursor = tblAttachments.Search(qf)
			While (rc.MoveNext())
				Debug.Print("Hello world")
			End While
		End Using

	End Using
Tags (1)
0 Kudos
6 Replies
Aashis
by Esri Contributor
Esri Contributor

ArcSDE requires the left and right curly braces in a Guid. Are they present in the where clause? 

		qf.WhereClause = "ROWGUID = '" + ATTACH_GUID + "'"

 

0 Kudos
EricPfirman
New Contributor III
Yes.
?ATTACH_GUID
"{a24da8ce-1cd4-42a6-bc48-199a33f6ec3b}"
0 Kudos
RobBurke
New Contributor III

Just thinking out loud here...

Does the row eventually appear in the Attachments table?  

Could row.Store() take a while, and the cursor creates, searches, and finishes before the row is fully in place?

 

Robert Burke
0 Kudos
EricPfirman
New Contributor III
The row appears in the table eventually, but not until I close and reopen the Window and run a bunch of code. I can't figure out where in the code the row is actually getting saved.
0 Kudos
Denny
by
New Contributor II

Just a curiosity question - can you try Using the Row as you do with the Table and RowCursor instead of calling row.Dispose() directly? 

0 Kudos
EricPfirman
New Contributor III

I just tried "Using" and it didn't help.

0 Kudos