Select to view content in your preferred language

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

641
6
11-28-2023 09:22 AM
EricPfirman
Occasional Contributor

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
Occasional Contributor
Yes.
?ATTACH_GUID
"{a24da8ce-1cd4-42a6-bc48-199a33f6ec3b}"
0 Kudos
RobBurke
Occasional Contributor

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
Occasional Contributor
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
Emerging Contributor

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
Occasional Contributor

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

0 Kudos