Binding a datagrid to a stored procedure...


Author
Message
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
How do I bind a grid to a stored procedure in Visual Studio 2005? The twist is that I would like to setup the grid at design time. Column headings, sizes, any additional formatting that I would otherwise have to do in code. Do I somehow create a dataset to bind the grid to initially?



P.S. I really appreciate the general .NET forum... its nice to be able to pull on your knowledge of .NET also.



Thanks
Replies
StarkMike
StarkMike
Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)Advanced StrataFrame User (738 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Ok, If i create a StrataFrame BO and use the FillByStoredProcedure method what do i point the BO to when I'm in the mapper? Because the StoredProcedure is made up of more than one table.



What do you guys think would be the best way to approach this problem. All I want to be able to do is bind the grid to something so that i am able to retrieve column names and setup the layout of the grid at design-time.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The BOMapper does not currently support mapping a business object to a stored procedure.  So, to create a strong-typed business object that maps to a stored procedure, you'll need to create a view that has the same structure as the stored procedure (it doesn't have to be deployed with the database, just created for temp purposes) or create a temp DDT profile and create a table in there with the same structure as the stored procedure.  Either of those will give you a source for the mapping information within the BOMapper.  Once the BO is mapped, it doesn't care where the data comes from, so you can create the structure from a separate object.
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
The business object's strong-typed properties do not have to reflect the data inside of the business object.  You can retrieve any data you like and access it one of two ways.  All business objects have an "Item" property that will retrieve a column specified:

myBo.Item("MyField") Or MyBo("MyField")

You can also access the data table within the BO and access the rows:

MyBO.CurrentDataTable.Rows(0).Item("MyField")

Ben's post is a more "pure" approach - but both options will work depending upon your circumstances.

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