Click here to Skip to main content
15,887,866 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to connect and authenticate an asp.net website and winforms programs to a mysql database. Was able to do so with ASP.net but how do I do that on winforms? I code in vb.net

What I have tried:

Googled like crazy. Added the connection settings and provider settings in app.config

Struggling with login code on winforms
Posted
Updated 8-Dec-18 20:24pm

1 solution

That's possibly more complicated than you think: if the MySql DB is part of your hosting service, then it's pretty unlikely that you can access it directly from a WinForms app as that requires that the DB be publically available - and that's rare for security reasons.

So start by "finding" the DB, and checking if you can access it via a DB management system from your dev PC. If you can, then that gives you a connection string (or at least the details you need for the connection string) you can use in your app.

If it doesn't ... it gets complicated. You could try asking your hosting service to allow remote access to the DB, but that's both dangerous (in that it's open to anyone who wants it, and the connections details will be in your app code) and insecure. It's also unlikely to work.
The other alternative is to try writing a web service which authenticates users for you against your non-public DB, publishing that to your hosting service, and accessing that from your new app. See what I mean about "possibly more complicated than you think"?

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900