StrataFrame Forum

Trouble with save

http://forum.strataframe.net/Topic799.aspx

By Kevin Lingofelter - 4/13/2006

Hello,

I am beating my brain trying to figure out what I did wrong. I am using an infragistics grid. I am setting the isListSource property to true in the BO and binding the BO to the grid.

In the AfterRowUpdate event of the grid, I am calling BO.Save();

This works fine on another form. Records are added, deleted and modified just peachy, but on this one form, the save method gives me this error:

"The CurrentRow could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 1.  CurrentRowIndex: -1."

Does this error give you any clues as what I'm missing?

Thanks!

By Kevin Lingofelter - 4/13/2006

well...not sure what the deal was. I deleted the grid and rebuilt the settings and now it's working. Sorry to clog the forums with stuff not SF related...Whistling
By Trent L. Taylor - 4/13/2006

You're not clogging anything.  That is what the forum is for.  If you start running into a problem again let me know.  I know that the Infragistics grid can be finicky at times when interacting with an ADO.NET data table. Smile
By vblain - 6/6/2006

hi,



found this thread and i'm also having problems with save. I'm trying to add a new record everything seems to work ok, when i click new i get an empty form with a ID of -1 but when i click save nothing happens the form just hang with no error given. i thought i was doing something wrong so i tried the same step in the sample project and same thing. no error the form just hangs. Have you ever experienced something like this?
By Trent L. Taylor - 6/6/2006

No.  But the first thing that you need to do is place the application in debug mode and see what is being executed on the server.  To do this you need to set the debug mode and file in the AppMain of the project.  It will look like this:

MicroFour.StrataFrame.Data.DataBasics.DataSources(0).SetDebugOn("c:\temp\mydebugfile.html", True)

Place the above code right after the ConnectionManager.SetConnections() in the SetDataSources() method in AppMain.  This will create an HTML file with every SELECT, INSERT, UPDATE, and DELETE call made through the framework during the session.  The file is updated before it is actually executed on the server, so even if it hangs, it should show up in the file.

The next question is what type of database are you using when this happens (also include what version)?  Run the app in debug mode first and see if it clues you in to what is going on then we can go from there.

By vblain - 6/6/2006

Command Settings

CommandText:    INSERT INTO [dbo].[Location] ([LocationName], [Address1], [Address2], [City], [State], [Zip], [Telephone]) VALUES (@LocationName, @Address1, @Address2, @City, @State, @Zip, @Telephone); SELECT [id] FROM [dbo].[Location] WHERE id = SCOPE_IDENTITY();

Command Parameters

@LocationName:    'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: LocationName | SourceVersion: Current]

@Address1:    'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: Address1 | SourceVersion: Current]

@Address2:    'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: Address2 | SourceVersion: Current]

@City:    'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: City | SourceVersion: Current]

@State:    'te' [DbType: AnsiString | Size: 2 | Direction: Input | SourceColumn: State | SourceVersion: Current]

@Zip:    '12341-2345' [DbType: AnsiString | Size: 10 | Direction: Input | SourceColumn: Zip | SourceVersion: Current]

@Telephone:    '' [DbType: AnsiString | Size: 14 | Direction: Input | SourceColumn: Telephone | SourceVersion: Current]



this is the argument that happens when i try to save, I'm usiing SQL 2000 with SP4 on Windows 2003 Server, the form is a basic SF Maintenance form. for the Zip and the telephone i'm using Mask Texboxes, each set for their respective Mask, the zip is sent to the BO but not the telephone number i entered (123)123-1234 as the phone number but the Statement above never received it, i verified that the business object is tied to the mask box and that the proper field is also set. Help.
By StrataFrame Team - 6/6/2006

Check the BindingUpdateMode property on the MaskedTextBox for the phone number and make sure it is set to OnPropertyChanged and try again... we just use the .NET DataBindings collection on the control to move the data back and forth, so if the binding is configured properly, everything should work.

Also, if you step into debug, check the DataBindings collection on the masked text box and make sure its count is greater than 0.

By Trent L. Taylor - 6/6/2006

Vince,

Did you use an SF masked textbox for the telephone?  If you did, make sure the BindingField property is set.  I am sure that you already know this, but just in case, there are properties on a masked text box to determine whether or not you want to include the making characters in the save.  This isn't your problem, just thought I would metion it.

So check to make sure that you have the BindingField and BusinessObject properties set for the telephone.  If you don't see those properties, then it is not an SF control Smile

Let me know.

By vblain - 6/6/2006

html>















































































































Command #:



1

Timestamp:



2006-06-06 11:44:20.453





General Command Settings

Command Type:



Text

Object Type:



System.Data.SqlClient.SqlCommand

Connection String:



Data Source=SVRSQL1;Initial Catalog=DiscoverSuccess;User ID=**;Asynchronous Processing=True

Transaction:



False



Command Settings

CommandText:



INSERT INTO [dbo].[Location] ([LocationName], [Address1], [Address2], [City], [State], [Zip], [Telephone]) VALUES (@LocationName, @Address1, @Address2, @City, @State, @Zip, @Telephone);

SELECT [id] FROM [dbo].[Location] WHERE id = SCOPE_IDENTITY();





Command Parameters

@LocationName:



'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: LocationName | SourceVersion: Current]

@Address1:



'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: Address1 | SourceVersion: Current]

@Address2:



'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: Address2 | SourceVersion: Current]

@City:





'test' [DbType: String | Size: 100 | Direction: Input | SourceColumn: City | SourceVersion: Current]

@State:



'te' [DbType: AnsiString | Size: 2 | Direction: Input | SourceColumn: State | SourceVersion: Current]

@Zip:



'12345-1234' [DbType: AnsiString | Size: 10 | Direction: Input | SourceColumn: Zip | SourceVersion: Current]

@Telephone:



'(123) 123-1234' [DbType: AnsiString | Size: 14 | Direction: Input | SourceColumn: Telephone | SourceVersion: Current]





well the telephone is being passed now, but it's still hanging, the masked textbox are the SF MaskedTextBox. it just seems that the business object is not executing the statement. But i can even step through once i click save the app become unresponsive.
By StrataFrame Team - 6/6/2006

Hrm... what version do you have installed, Vince?

1.4.1 pre-release or 1.4?

There could be an issue with the ListChanged event firing during the save (which causes the app to lock because the main thread is sleeping)... Do you have the business object on a grid using the BusinessBindingSource?

By vblain - 6/6/2006

i'm using 1.4.1 currently, the form is just a basic maintenance form no grid, i dropped SF textbox for each fields

By StrataFrame Team - 6/6/2006

I'm checking right now, Vince to see if I can reproduce it.
By vblain - 6/6/2006

in the sampl project provided, the Customer Maintenance Form does the exact same thing, when saving it just hangs
By StrataFrame Team - 6/6/2006

Does it only hang when you add a new record, or does it hang when you edit an existing record and save it?
By StrataFrame Team - 6/6/2006

I found it, Vince.  I'm fixing it right now and I'll get you the install once I get it built.
By vblain - 6/6/2006

you guys are awesome, can't get any better service then here
By StrataFrame Team - 6/6/2006

OK, Vince, fixed the problem and re-created the install.  The latest version is available within the MyAccount area of the website and from https://www.strataframe.net/downloads/StrataFrame.zip

Basically, when the new PK was retrieved after an insert, the internal DataTable would raise its ListChanged event, and the business object would try to raise its property descriptor changed event (for 2-way binding) and the binding would try to refresh its value.  But, the binding resides on the main thread, and the main thread is blocked while the update threads push the data to SQL Server, so the whole thing froze.

Give that new install a shot Smile

By vblain - 6/6/2006

everything working 100%. Thank you again for your top of the line support.
By StrataFrame Team - 6/6/2006

That's what we're here for Smile