Friday, March 30, 2012

How do i add my database to "data sources"?

In Lesson 9 as you can see here (at 16:50), a connection is created against his .mdf database, and the dataset is shown in the "Data Source" window/panel.
He can then simply drag the data source onto the form, and controls are created and bound automaticly - or drag them as a datagridview to the form.

That is what i want to do, but i have some problems...

I have set up a connection to my SQL Express database, and a dataset is created without problems. The problem is that this dataset does not show up in "Data Source". Actually, i have never seen anything in that panel before, in any of the data sources i have added!

What am i doing wrong? In the menu i click "Data" --> Add new data source --> finish the "wizard". Then i click "Data" --> Show Data sources --> It's EMPTY!

Does this also happen if you just connect to a regular database, not through .mdf file? When i tried it with regular database it works, but although "Data Source" panel is not empty, it contains only DataSources names which are empty inside and not possible to drag onto designer. Is it what you mean by "empty"? If so, then you can click on "Server Explorer" and drag and drop your dataset from there. Then your data sources are going to get populated also.|||

I am trying to connect to a regular database, stored on a different computer running MSSQL Express. Connection and everything is okay.

By "empty", i mean completely empty - theres nothing in the panel - no items at all.

See this screenshot:

http://dritbra.com/temp/datasource.png

As you can see on the screenshot, the items appears as soon as something else than the form designer is active...

Btw, when viewing the server explorer i can't drag the items to the form... The mouse has this "not allowed" icon.

|||So theres really no one who can even confirm that the data set is supposed to appear in the data source panel, available for "drag and drop"?|||

Ok, this appears to be a known issue - probably occuring because i have had a beta installed (allthough i have completely reinstalled final version two times on this computer).

SOLUTION:

OPEN:
C:\Documents and Settings\<UserName>\Application Data\Microsoft\VisualStudio\8.0\DataBindingSetting\WinFormControls.xml

ADD THIS:

<DataType Name="System.Collections.IList">
<BindableControlInfo Name="DataGridView" Type="System.Windows.Forms.DataGridView" AssemblyName="System.Windows.Forms, Version=2.6.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<BindableControlInfo Name="[None]" Type="Microsoft.VSDesigner.Data.BindManager.NoneControlPlaceHolder" />
</DataType>

No comments:

Post a Comment