StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Handling varchar fieldsExpand / Collapse
Author
Message
Posted 02/10/2006 3:46:04 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
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.

Post #538
Posted 02/10/2006 4:57:29 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 5:04:58 PM
Posts: 4,780, Visits: 4,744
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. 

Post #539
Posted 02/10/2006 6:54:36 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
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)
Post #540
Posted 02/10/2006 6:59:45 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
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
???
Post #541
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 3:53am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 12 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.