Bug #41629 A connectionstring cannot be re-used once I shut down Visual Studio 2008
Submitted: 19 Dec 2008 9:21 Modified: 17 Feb 2010 14:14
Reporter: tzu chjeh wu Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:5.2.5, 6.2.2 OS:Windows (Vista Ultimate SP1)
Assigned to: Reggie Burnett CPU Architecture:Any
Tags: connector

[19 Dec 2008 9:21] tzu chjeh wu
Description:
A connectionstring set in web.config cannot be re-used once I shut down Visual Studio 2008 Professional.

It will continue working for the existing controls, gridviews etc. But not for any new controls.

Note this occurs if I use the wizard to do my work.

I can still use the same connectionstring via coding.

How to repeat:
1) Create a sqldatasource
2) Select the MySQL provider
3) Provide database name, login , password and server location
3) Create a select statement from the wizard
4) If you run test, it will fail, is this a known bug?
5) Use it in a gridview for testing purposes
6) Once it works and the auto generate columns shows all you columns, shut down Visual Studio 2008
7) Now, restart Visual Studio 2008
8) If you try to re-use the connector on another control, it won't work anymore giving a "object reference not set to an instance of an object at VSDataObjectSupport(123,6)" error
[12 Feb 2009 14:21] Tonci Grgin
Hi Tzu and thanks for your report.

It is impossible to repeat it with VS2005Pro which makes me think something's wrong in VS2008. Did MS issued a SP for it yet ;)

Anyway, I have no means for testing this until I obtain copy of VS2008 which could be a long wait, sorry.

There was one more question:
  4) If you run test, it will fail, is this a known bug?

I think you have many datasources / other data components and actual SELECT you run comes from them not the one you typed. But can't be sure as VS2005 works as expected.

I will ask around if anyone has VS2008...
[6 May 2009 9:10] Tonci Grgin
Ok, here's what I did using c/NET 5.2.6GA:
...
4) If you run test, it will fail, is this a known bug?

Works for me, no problem.

8) If you try to re-use the connector on another control, it won't work anymore giving a "object reference not set to an instance of an object at VSDataObjectSupport(123,6)" error

Now I added one more GridView and set DataSourceID to same datasource as for first grid. Testing Default.aspx shows *both* grids with data in them...

I have noticed 2 problems:
  - In the first run (points 1-6) when I added first GridView I was able to pick DataSourceID from drop down list in grid properties. After adding second grid, this is no longer possible for any of them (ie. I had to type in DataSourceID)
  - When I tried to change saved connection to new one, *then* I get "object reference not set to an instance of an object at VSDataObjectSupport(123,6)" error but I'm not sure if that's a bug as I have objects linked to that connection string...

So, I am unable to repeat this problem. My code looks like:
<body>
    <form id="form1" runat="server">
    <div>
    <asp:sqldatasource ID="Sqldatasource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CSbug41629 %>" 
    ProviderName="<%$ ConnectionStrings:CSbug41629.ProviderName %>" 
    SelectCommand="SELECT * FROM bug40529"></asp:sqldatasource>
        <asp:gridview ID="Gridview1" runat="server" EmptyDataText="No Data" 
            DataSourceID="Sqldatasource1"></asp:gridview>
        <asp:GridView ID="GridView2" runat="server" EmptyDataText="No Data" 
            DataSourceID="Sqldatasource1">
        </asp:GridView>
    </div>
    </form>
</body>
and browser shows both grids with all the data one on top of other.

Is there anything I'm missing?
[6 Jun 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[16 Dec 2009 17:20] Chandan Agrawal
Hi, 

I am also getting the same error. I am using the latest GA version which is 6.1.3.

Regards,
Chandan
[8 Feb 2010 13:29] Jean-Luc Barraud
I confirm the bug from tzu chjeh wu. 

I use .NET connector 6.2.2 and VS 2008.

As soon as a connection string has been created and used (and works !) it's impossible to reuse it for example to change the SQL command of a SQL datasource or create a new SQL datasource.

It's very annoying.
[8 Feb 2010 13:54] Tonci Grgin
Let me recheck...
[8 Feb 2010 14:03] Jean-Luc Barraud
In fact the problem is with the IDE.

In the code, the connection string can be re-used several times with success :

   <asp:SqlDataSource ID="SqlDataSourceOEBrasage" runat="server" 
        ConnectionString="<%$ ConnectionStrings:captagelimogesConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:captagelimogesConnectionString.ProviderName %>" 
        SelectCommand="SELECT equipements.nomEquipement, oe.numLotOE, oe.phaseOE, oe.dureeOE, oe.dateDebutOE, oe.dateFinOE, oe.qteBonneOE, oe.qteMauvaiseOE, oe.qteTravailleeOE FROM equipements INNER JOIN oe ON equipements.numEquipement = oe.equipementOE
where equipements.nomEquipement like 'Brasage%'">
    </asp:SqlDataSource>
    <p>
        &nbsp;</p>
    [...]
        <asp:SqlDataSource ID="SqlDataSourceAleasBrasage" runat="server" 
            ConnectionString="<%$ ConnectionStrings:captagelimogesConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:captagelimogesConnectionString.ProviderName %>" 
            SelectCommand="SELECT equipements.nomEquipement, aleas.typeAlea, aleas.graviteAlea, aleas.dateDebutAlea, aleas.dateFinAlea FROM aleas INNER JOIN equipements ON aleas.equipementAlea = equipements.numEquipement WHERE (equipements.nomEquipement = 'Logiciel Pilotage Brasage')">
        </asp:SqlDataSource>

BUT what is impossible is to configure a data source from the "Design" view and reuse the existing connection.
[11 Feb 2010 11:24] Tonci Grgin
Jean-Luc, I tried to reproduce this but I am not all that clear on what to do... So a colleague of mine will also try after he get's VS2008.
Now, if you, by any chance, have Windows 7, I'd like you to record steps I need to follow using Problem Steps Recorder (http://technet.microsoft.com/en-us/windows/dd320286.aspx) and upload movie to, say, YouTube.
If this is not an option, we'll wait on Bogdan.
[11 Feb 2010 11:31] Tonci Grgin
For the sake of completeness here's what I did:
  o Winforms project in VS2008Pro, c/NET 6.2.2
  o As I already have lot's of connections saved, I added tow datasets with different connection strings. Each dataset is populated with few tables.
  o Added 3 grids to main form, 2 connected to first dataset, 1 to second dataset.
(see attached image)

All grids and datasets show data even after several restarts.
[11 Feb 2010 11:32] Tonci Grgin
SShot of VS2008 project

Attachment: Bug41629.jpg (image/jpeg, text), 83.98 KiB.

[11 Feb 2010 12:02] Jean-Luc Barraud
How to reproduce the bug VS 2008 (1)

Attachment: Bugmysql.png (image/png, text), 127.90 KiB.

[11 Feb 2010 12:02] Jean-Luc Barraud
How to reproduce the bug VS 2008 (2)

Attachment: Bugmysql2.png (image/png, text), 131.93 KiB.

[11 Feb 2010 12:04] Jean-Luc Barraud
See the 2 screen copy :

1) right clic on EXISTING SQLdataSource and choose "configure data source"
http://bugs.mysql.com/file.php?id=14024

2) Choose connection string , clic NEXT and... 
http://bugs.mysql.com/file.php?id=14025
[15 Feb 2010 15:50] Tonci Grgin
Verified as described using c/NET 6.2.2 and .NET FW 3.5.
[15 Feb 2010 15:50] Tonci Grgin
SS of problem

Attachment: Bug41629-1.jpg (image/jpeg, text), 147.29 KiB.

[15 Feb 2010 19:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/100436

791 Reggie Burnett	2010-02-15
      - fixed bug where a connection could not be reused in the IDE in some circumstances (bug #41629)
[15 Feb 2010 19:54] Reggie Burnett
fixed in 6.0.6, 6.1.4, 6.2.3, and 6.3.1+
[17 Feb 2010 14:14] Tony Bedford
An entry has been added for changelogs 6.0.6, 6.1.4, 6.2.3, 6.3.1:

A connection string set in web.config could not be reused after Visual Studio 2008 Professional was shut down. It continued working for the existing controls, but did not work for new controls added.