Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using AutoInc fields
Message
From
24/06/2010 13:33:22
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
24/06/2010 13:09:11
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01470401
Message ID:
01470436
Views:
33
I didn't realize it was the save causing you the problem. You should be able to set the binding mode to one-way since all you want to do is display it. Formatting would depend on if this is only for this single purpose or not. You could just do that in the UI, but if you always want to display it in that manner, then you could add a readonly property in your business class that returns the ID property value formatted as a string. Then bind to that instead. The problem with this is you are going to have to deal with the value again when you are using it in your grid to go fetch that record for editing. If this is not your PK, why not change your data to be stored in that format as a string to begin with? you can still make it unique.
Tim

>Ah,
>
>I guess it wasn't working for me because I was displaying the Agent # field (albeit readonly) in an mmtextbox. If I remove that control it does save.
>
>OK, so now, how do I display the number, ideally padded left with zeroes? I would like to display this number on a lookup form in a grid so that the user can click on the agent number to edit the agent details by displaying another form for just this agent as well as on the Agent edit form. Should I change my Stored procedure to extract a formatted field, or should my BO do something to format it, or do the formatting in the UI? Or are there other better options?
>
>Is it recommended to use VFPToolkit for .NET to get functions like PADL()?
>
>>Frank,
>>
>>The warning is just that, a warning. Your code should work but the warning is telling you that you never are assigning a value to a defined variable which will be handled by SQL Server when you add a new row.
>>
>>Update: Are you sure it is Identity column in database?
>>
>>HTH
>>
>>>Hi,
>>>
>>>using MM.NET 3.6 and SQL Server 2008.
>>>
>>>If I have an AutoInc field (Identity in SQL Server) and use the Business Layer Generator, I then get a warning when I build my project:
>>>
>>>Field 'SamaanSystems.IAS.Business.AgentEntity._agentNumber' is never assigned to, and will always have its default value 0
>>>
>>>Now, I have not set this field as a Primary Key as it is actually being used as a Candidate Key. Also the value never gets generated as far as I can tell.
>>>
>>>What do I need to do to get this to work?
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform