Hi, I am getting very very annoyed trying to find the refrence for MySqlConnection. I am trying to connect to my database, but everytime I use MySqlConnection I getting the following error:
The type or namespace name 'MySqlConnection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\NAME\Local Settings\Application Data\Temporary Projects\WindowsFormsApplication1\Form1.cs 25 13 WindowsFormsApplication1
Yes I know that I am missing a refrence but I honestly have NO CLUE what I ned to correct this error. Thanks for any help.
Loading

Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Aug 6, 2010, 12:11 AM EDT
First create the folder with in your application and give the sqlconnection like
sqlconnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFileName="+Application.StartupPath.Remove(Application.StartupPath.Length-10,10)+@"\db\PAM.mdf;Integrated Security=True;User Instance=True");
by the above maintain the database any where
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 19, 2010, 9:19 AM EST
Are you sure you have this line at start of "Form1.cs"
using System.Data.SqlClient;
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 19, 2010, 9:34 AM EST
If you have used some other assembly like this one:
http://www.devart.com/dotconnect/mysql/docs/Devart.Data.MySql~Devart.Data.MySql.MySqlConnection_members.html
then
"Add Reference" from "Solution Explorer" and then add refernece of Devart.Data.MySql.dll
then in code/Form1.cs
right Click on the word "MySqlConnection", in the menu find Resolve and click on the first item.(if casing of MySqlConnection will be correct you will get item)
I hope it will help you.
Sam HobbsRank #107 · 20.5K reputationPosted Dec 19, 2010, 12:40 PM EST
Sam HobbsRank #107 · 20.5K reputationPosted Dec 19, 2010, 1:12 PM EST
http://www.bing.com/search?q=MySqlConnection&go=&form=QBLH&qs=n&sk=&sc=6-15
Some of the results of that are:
Note that you might need to download the relevant library to get the MySqlConnection class and related software.
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 19, 2010, 1:21 PM EST
I have already posted the same link if you have been read my comment carefully and I have provided the solution for that also.
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 19, 2010, 1:26 PM EST
I said this:
>>>there is no MySqlConnection class that MSDN and .Net offers
In a sense that I was guiding @Steve for "Add Reference" so if its a 3rd party .dll it will be available to him only(which he didn't declare yet) not comes with .net library.
Sam HobbsRank #107 · 20.5K reputationPosted Dec 19, 2010, 3:56 PM EST
In your first message, you said to use "using System.Data.SqlClient;", correct? That sure looked incorrect to me.
In your second message, you said to use SqlConnection instead of MySqlConnection, correct? If my understanding is incorrect, then I apoloigize for misunderstanding.
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 20, 2010, 3:52 AM EST
no problem. My aim is not to hurt you. we are the part of same platform.
Sam HobbsRank #107 · 20.5K reputationPosted Dec 20, 2010, 11:32 AM EST
Shahan AyyubRank #5,163 · 309 reputationPosted Dec 20, 2010, 12:44 PM EST
I should have consider your seniority and respect your opinion. I will take care of this from next time.
Thanks.