Unable to find connection MyConnection (MySettings) for object “MySettings”

As a programmer you can imagine the occasional “All nighters” and by the end of the day (actually the next morning) sometimes you feel like you’ve been through the ringer (colloquial term used as a method to dry clothes).

I was working away on a project in VS 2010 and was adding a Table Adapter when I got this friendly message…

“Unable to find connection ‘MyConn (MySettings)1’ for object ‘MySettings’. The connection string could not be found in application settings, or the data provider associated with the connection string could not be loaded. .”

I googled the problem, because every few seconds after that I kept getting “Object Reference not set to an instance of an Object” (sounds like something Yoda would say) and was stuck cold to do any troubleshooting on my own. Well, I did find others that had a similar problem but they went deep into the workings of all the behind the scenes stuff that we usually just point and click to do. Some guy had been waiting 2 weeks from Microsoft for an answer, because they could’nt figure it out. Since I’ve been developing for a long time I realize you can never depend on the creator of the language, I actuall went to the creator of a DBMS language in the 80’s and asked them directly “What do you mean that your compiler is telling my code “it’s too complex” (thank goodness I don’t write too many 5 dimentional arrays any more).

Ok, back to the story… I spent a few hours changing my SQL query thinking I had really done something that it could’nt understand (I had some CASE statements within the inline SQL statement) and that my problem was there.

After leaving it alone for a while I went back the next night to see if I could try something different. Since there is always more than one way to handle an issue I was prepared to change my plan, but, I really had a great query that would save some code time if I could just get it to work.

Well, to make a short story longer, I ended up creating a new dataset xsd file and adding that to the project. I left the other defined dataset file intact for now, I recreated the query in the new dataset and guess what? It saved just fine (no errors at all), Since this was a new project I was able to cut and paste any existing (working) table adapters I had in the original dataset to the new one. Once I made the small modificaitons in code where I referenced the original dataset to the new dataset, deleted the original dataset and everything was back to “Full Steam Ahead”.

The moral of the story is, you learn early that you can’t get frustrated when you have to spend 4-5 hours trouble-shooting a problem that has no basis for happening in the first place, when we could have done so much more in that same amount of time.

Update: Obviously I was’nt going to get off that easy. This time it happened again when I was just creating a regular dataset, I worked around this by creating a new dataset file (xsd) and created my dataset there. I couldnt copy this new datatable over to the other dataset but, its working.

Update [Probable Solution]: OK, this may be a clue. I was adding another Query to an existing dataset and I got the object referrence error, this time I noticed that whenever I double checked the connection string on the individual data adapters (just click on the name of the table adapter and look at properties) one of them was using a data connection that isnt part of the project. So double check your tableadapter connection strings to make sure there valid. I’m not sure why all of a sudden it decided to act like this, but, this might save you some time.

(advertisement)

Are They Faking You Out – “Here’s a picture I found about you!”

They’ll try anything they can to get you to give yourself a virus. As if emailing you that their your bank wasn’t enough.

Well, the last few weeks I’ve been getting emails that taunt me to click on a zip file that exclaims that an old friend found a picture of me (or of something). Well, even when I started getting them from known email address I still ignored them.

Keep in mind that anyone (and especially the evil ones) can imitate a “From” email address so you’ll think it’s from someone you know. Unless you are expecting it, don’t just click away. What to do with that email? Just delete it!

Why do I have to apologize for being an American

Seems like working hard to get on top just isn’t as popular as it was when I grew up. There wasn’t such a thing as a computer, but, I spent countless days and nights to figure it out. Every new type of computer that came out I had to try…

I owe a lot to the TRS 80, the Timex computer, the Texas instruments pc, and even the Commodore 64

Before PC’s started coming out I reminisce about how I would type basic code from examples and write data lines, save them to cassette tape and reload them to work on them again (which didn’t always work 100%). I started investing in stock and created a graphic program to show the historical data of the investments by typing in the daily prices from the newspaper. It took a lot of stick-to-itiveness to do it.

When I first started writing business applications I kept one thing in mind through all of this experience, there isn’t anything I can’t make a computer do. How many times have you hired a programmer, or consultant and the next words out of their mouth is “That can’t be done”? Why? Call me crazy, but, that’s the secret, if you work hard at something, don’t accept defeat!

Seems like the up and coming have an attitude of pay me a lot now, but, then show me how to do it because I don’t know how. I know, it seems like a rant of “I walked 5 miles in the snow to get to school when I was your age…” that our parents told us. But, really, seriously?

The moral of the story is, working hard is the American way, and a Christian ethic, so lets not forget it!

If you have a project that someone told you couldn’t be done, give me a call, then stand back and watch an American do it!

(advertisement)