0

Hello guys I have a confusing question! If I'm using WCF to create a web service, then I'm trying to connect my service to a database which is a mysql one!

After I have installed the .NET connector, still I can not refer to the database using

using MySql.Data.MySqlClient;

the client will be adding some sort of ID to the service and I want the WCF app Parse that value and feed it to the database!

I searched on StackOverflow as well and I found these two below to be an approach as well :

using System.Data.Odbc;
using System.Data.SqlClient;

Could this be connecting my service to the database ? Please if you think I have a misunderstanding in the way I want to load the drivers let me know!

THANKS

4
  • Do you get an error when your service tries to connect to the database? Commented Nov 19, 2011 at 8:56
  • @Tim yes! Like when I want to type down MySql it underlines it in red and saying that the reference is not there! Commented Nov 19, 2011 at 9:10
  • I see you have an answer but I just want to point out that your phrasing would suggest that you don't fully understand what the "using" directive does. If I'm wrong, great, if not have a look at this: msdn.microsoft.com/en-us/library/sf0df423.aspx Commented Nov 19, 2011 at 12:48
  • Thanks @StephenKennedy , not really that good with db! Commented Nov 19, 2011 at 15:51

1 Answer 1

1

Based on your comment, it sounds like you added the MySql.Data.MySqlClient using statement to your project file(s), but you didn't actually add the DLL to your project.

You can add the DLL to your project by looking in the solution explorer (usually the top-right window in Visual Studio), right-click on References, select Add Reference (not Add Service Reference) and then navigate to where you put the MySql drivers.

Adding a using statement only works when the underlying assembly is included in the project's references.

Sign up to request clarification or add additional context in comments.

1 Comment

Ow man! Thanks... I did this yesterday with ASP.net web services to a desktop application, I didn't know that this will need same thing as well!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.