This is a migrated thread and some comments may be shown as answers.

DataAccess with BindingSource & Windows Forms Problem

3 Answers 104 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bassam
Top achievements
Rank 1
Bassam asked on 12 Aug 2014, 11:32 AM
Hello,

Im evaluating Data Access ORM as a gate to also purchase DevCraft complete package , I want to move away from Entity Framework into a more powerful and clean ORM, I read the features and I like it, installed the free edition but having a problem getting data binding to work properly as I expect in a windows forms test app, here is what I did (im using SQL Server 2012):

1. Create a class lib project , create the domain model , insert only 1 table
2. at same solution in the main app exe windows forms app , I referenced the open access 2 dlls , config file , class lib project ,  no problem
3. in the main app , I created a project new data source , pointed to the domain model then the table object (entity)
4. in a new form, i dragged a MS DataGridView , then dragged the object entity from the data source window into the GridView , then columns are automatically created and a BindingSource is created in the form tray , no problem so far and this exactly so far like entity framework
5. in the form load I created a new context , then a LINQ query to read all the data like that
myContext=new ControlModel
dim IPList = From a in db.IPLists
IPListBindingSource.DataSource=IPList

6. running the app , now I can see the data in the grid and edit it , however I can NOT add new rows, the + sign of the navigator is not active , if I enforce that by
IPListBindingSource.AllowNew=True
then the + sign in the navigator is now active and I can add new row to the grid but when I try to save to SQL server later by running
db.SaveChanges
nothing is saved to the database

7. same problem with deleting rows , when I delete a row from the grid then save
db.SaveChanges
its not deleted from database

so I have problem in both Delete & Insert , but SELECT (LINQ) & EDIT then save works fine

can you kindly tell me what im doing wrong , all this works fine with Entity Framework with exactly same steps

Thank you
Bassam

3 Answers, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 15 Aug 2014, 10:01 AM
Hello Bassam,

Thank you for contacting us.

To help you in your evaluation process of the integration between Telerik Data Access and Windows Forms, I would suggest to you to take a look at the WinForms Quick - Start section in our documentation and the Basic Data Binding with Windows Forms sample in Telerik Data Access Samples Kit.

In both of this suggestions you will find one and the same example, which demonstrates all the basic CRUD operations executed with the help of RadGridView from the Telerik UI for WinForms suite. The documentation will give you a step-by-step guide for the reproduction of the sample, while in the code delivered with Samples Kit you can test your own modifications and ideas.

I hope this helps. If you need further assistance, do not hesitate to get back to us.



Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Bassam
Top achievements
Rank 1
answered on 21 Aug 2014, 12:57 PM
Hello Doroteya ,

Thank you for your reply , I have read and followed the example you specified , it works but by implementing a background code behind the grid to delete rows or in case of adding new rows it opens a totally new grid to enter one .

in my test, to delete the row in the background code it was easy, but I don't want to open new form for user to add a new row , I want the new row to be added to the context once user enters it in the main grid, and im wondering why this is not happening automatically like the Entity Framework , As a work around and while validating the row event of the grid I added the row just entered into the context using code , but it needs more work sometimes to manage and would be easier if this is done automatically along with deleting a row, it would be easier

appreciate your reply, as maybe there is a method and I don't know it.

Thank you
Bassam
0
Doroteya
Telerik team
answered on 26 Aug 2014, 08:57 PM
Hello Bassam,

Thank you for your feedback.

A scenario like the one you describe is possible to be implemented with Telerik Data Access, although currently there is no out-of-the-box resource that demonstrates it. However, in this forum post, you can find an example that will guide you how to add new records through the grid and how to display related data. The project attached to this post is implemented for Visual Studio 2012 and the language is VB. In case you prefer using C#, you can use the Telerik Code Converter to help you with the translation.

I hope this helps. If you need further assistance, do not hesitate to get back to us.


Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
Bassam
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Bassam
Top achievements
Rank 1
Share this question
or