Handling varchar fields


Author
Message
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
I have a database field SendMethod varchar(10).



When I refer to this field after a Fill procedure, for example as:

bo.SendField the contents is "FAX " padded to a length of 10.

I think that for a varchar(10) field, the contents should be "FAX" and for a char(10) the contents should be "FAX ".



If the current behavior is correct then I will have to Rtrim every reference to the field in the BO, which doesn't sound appealing.



Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Daniel,

I am not sure exactly what you are trying to say.  If you have a field typed as a VarChar(x), and you store a value of "FAX", it will only store and retrieve "FAX"  however, if you are using a char(x) type, if you store a value of "FAX" SQL Server will return a value of "FAX       ".  StrataFrame BOs will retrieve the value as it is stored in the database.  If you have a VarChar(x) field that has padding on the right, it had to be stored that way.  If you store a padded value into a VarChar field, it will respect that padding and keep it in the database. 

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
You're right. That was an artifact of converting from char to varchar.



I've now gotten to the point of trying to save and update to a Log record. When I execute _Log.Save() I get:

Value cannot be null.

Parameter name: key

System.ArgumentNullException: Value cannot be null.

Parameter name: key

at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)

at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)

at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

at MicroFour.StrataFrame.Data.SqlDataSourceItem.CreateDbParameter(QueryInformation QueryInfo, String FieldName)

at MicroFour.StrataFrame.Data.SqlDataSourceItem.BuildUpdateCommand_NonSP(QueryInformation QueryInfo)

at MicroFour.StrataFrame.Data.SqlDataSourceItem.BuildUpdateCommand(QueryInformation QueryInfo)

at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler)

at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
From the InnerException:

StackTrace = " at MicroFour.StrataFrame.Business.BusinessLayer.SaveBase(Boolean Transactional, String TransactionKey)\r at MicroFour.StrataFrame.Business.BusinessLayer.Save(Boolean Transactional)\r at TEST_FaxSending.Form1.timer_Tick(Object sender, EventArgs e...



It looks like maybe the BusinessLayer.SaveBase is requiring a key name even though Save() and Save(false) imply that the save is not part of a transaction

???
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search