Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > problem with linq(project inside)
 

problem with linq(project inside)

hi here
i have created a simple project with linq, i am study
but i cannot bind a datagrid
where is the error?
there are no error inside of compilation, but on run it seems with no record ;(

you can download my simple project

http://immobilzero.com/folder/provalinq.rar


hi
Amodio  Sunday, September 27, 2009 12:01 PM
Hi Amodio,

I have downloaded your project. After I read your code, I found some problems with it. Here is the detail.

1. You have not load data for the DataSet (DBDataSet). According to your logical, I think you should add the following code after Dim DS As New DBDataSet and before Dim Fonte = From el In DS.Anagrafiche _
Select el.Cognome
Dim adapter As ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter = New ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter()
adapter.Fill(DS.Anagrafiche)

2. Bind DataGridView.DataSource to Fonte.AsDataView() instead of Fonte

The whole solution code looks like this.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As New DBDataSet
Dim adapter As ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter = New ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter()
adapter.Fill(DS.Anagrafiche)

Dim Fonte = From el In DS.Anagrafiche _
Select el
Me.AnagraficheDataGridView.DataSource = Fonte.AsDataView()
End Sub

Since I don’t have the same database environment to test the code, so please test it and tell me if it works.

Sincerely,
Kira Qian
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
  • Marked As Answer byAmodio Tuesday, September 29, 2009 11:32 AM
  •  
Kira Qian  Tuesday, September 29, 2009 8:52 AM
Hi Amodio,

I have downloaded your project. After I read your code, I found some problems with it. Here is the detail.

1. You have not load data for the DataSet (DBDataSet). According to your logical, I think you should add the following code after Dim DS As New DBDataSet and before Dim Fonte = From el In DS.Anagrafiche _
Select el.Cognome
Dim adapter As ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter = New ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter()
adapter.Fill(DS.Anagrafiche)

2. Bind DataGridView.DataSource to Fonte.AsDataView() instead of Fonte

The whole solution code looks like this.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As New DBDataSet
Dim adapter As ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter = New ProvaLinq.DBDataSetTableAdapters.AnagraficheTableAdapter()
adapter.Fill(DS.Anagrafiche)

Dim Fonte = From el In DS.Anagrafiche _
Select el
Me.AnagraficheDataGridView.DataSource = Fonte.AsDataView()
End Sub

Since I don’t have the same database environment to test the code, so please test it and tell me if it works.

Sincerely,
Kira Qian
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
  • Marked As Answer byAmodio Tuesday, September 29, 2009 11:32 AM
  •  
Kira Qian  Tuesday, September 29, 2009 8:52 AM

You can use google to search for other answers

Custom Search

More Threads

• LOGIN control/form in VB 2005
• Using an Access database hosted @ IIS
• TreeView Control and BindingSource
• ObjectDataSource & XML columns
• datagrid master detail?
• Combo Box Databind Using Dataset In C#.net
• How to bind a form property to an "external" DataSource and the opener form
• C# - embeed controls in DataGridView
• binding navigator
• Please Help! Radio Buttons and Forms are driving me nuts!!