You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 2, 2023. It is now read-only.
I am trying to read bad data from a DateTime column. Because it cannot parse it to a DateTime it breaks, and I cannot find a suitable alternative method to collect this bad data so I would prefer to use .GetString(myCol) for all columns so I can deal with the parsing and error handling myself.
The text was updated successfully, but these errors were encountered:
The simplest solution is to use GetBytes, then convert the bytes to string and parse the string.
Or you can replace the DateTime parsing entirely using custom coumn class:
classMyDateTimeColumn:DateTimeColumn{publicMyDateTimeColumn(stringname,intoffset):base(name,offset){}protectedoverrideDateTime?DoLoad(byte[]buffer,intoffset,Encodingencoding){stringdateTimeString=encoding.GetString(buffer,offset,Size);// parse and return the string}}classMyHeaderLoader:HeaderLoader{protectedoverrideColumnCreateColumn(bytesize,bytetype,stringname,intcolumnOffset){if(type==NativeColumnType.Date){returnnewMyDateTimeColumn(name,columnOffset);}returnbase.CreateColumn(size,type,name,columnOffset);}}classProgram{staticvoidMain(string[]args){usingvartable=Table.Open("C:\\file.dbf",newMyHeaderLoader());// use the table}}
Hope it'll help 🙂
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am trying to read bad data from a DateTime column. Because it cannot parse it to a DateTime it breaks, and I cannot find a suitable alternative method to collect this bad data so I would prefer to use .GetString(myCol) for all columns so I can deal with the parsing and error handling myself.
The text was updated successfully, but these errors were encountered: