View previous topic :: View next topic |
Author |
Message |
lolAnonymous Expert Cheater Reputation: 1
Joined: 19 Jul 2015 Posts: 154
|
Posted: Wed Nov 30, 2016 12:47 pm Post subject: C# Project with Database shit |
|
|
Hello guys..
I am making a big project for my "Friends" only. I am using Sql Database..So I am directly coming to the point :
1) I have no idea that how to use database for that project (I know it with localhost Only) And I am not gonna send my database file along with my exe file.. So what should I do? Is it possible to add the database file in the solution?
Thanks In Advance.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Nov 30, 2016 2:03 pm Post subject: |
|
|
Either switch and use SqlLite if you want a local database file or you are goign to have to create a server to host the database and a middle-man solution to connect to the database. If you leave the database info inside of your exe you are just asking for it to be hacked.
_________________
- Retired. |
|
Back to top |
|
|
lolAnonymous Expert Cheater Reputation: 1
Joined: 19 Jul 2015 Posts: 154
|
Posted: Wed Nov 30, 2016 4:02 pm Post subject: |
|
|
Quote: | If you leave the database info inside of your exe you are just asking for it to be hacked. |
Actually I was thinking the same... So can u explain or send me a tutorial on how "to create a server to host the database and a middle-man solution to connect to the database"
Thanks for your reply...
Thanks In Advance..
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Nov 30, 2016 7:02 pm Post subject: |
|
|
You need to buy a web server host that gives you a database.
Use whatever database and programming features they provide.
Setup a web application that accesses your database and executes the SQL.
Have the web application forward the results through HTTP.
Now within your trainer, it makes a call to that service to access your database.
Go read up on ASP if you like C#.
|
|
Back to top |
|
|
lolAnonymous Expert Cheater Reputation: 1
Joined: 19 Jul 2015 Posts: 154
|
Posted: Wed Nov 30, 2016 8:28 pm Post subject: |
|
|
Ah I forgot to mention that I am going to learn ASP but because my exams are so near so it is making me confuse to decide that I should do the course now or not... Btw not doing the course now means wait 1 year...
Thanks Zanzer and Atom0s for both of your help...
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Wed Nov 30, 2016 8:39 pm Post subject: |
|
|
There are a few methods you can go about doing what you are doing, it mainly depends on how much time you plan to invest into the project and how much money you have for hosting.
If you want to go cheap on hosting, then you are going to land up doing something in PHP or another simple and commonly supported language.
If you want to do things a bit more proper, you will want Windows based hosting that supports WCF services. And you will want to write a WCF service to process your requests and such which integrates directly into C# properly.
For the PHP methods, you can do things multiple ways.
1. A simple PHP script that takes URL variables either via GET requests or via POST requests. You can do things like:
Code: | yourscript.php?action=login&username=SomeName&password=SomePersonsPassword |
This is usually the most common for quick thrown together things.
Keep in mind since you are doing all the work you need to code things carefully or else they will be vulnerable to SQL injection.
2. You could build out a REST or SOAP API interface with any of the thousands of free scripts available online. This would let you make things like:
Code: | yoursite.com/api/login/SomeName/SomePassword |
If you want something like this, I'd recommend Slim Framework.
3. Doing a SOAP API similar to REST, there are dozens of things similar to Slim Framework that handle with SOAP instead.
If you want to go a more proper route, and can afford the extra hosting for a Windows based server, I would recommend you write WCF services to communicate with your database.
ASP is not worth investing time into learning. The language is terrible, has very low usage in the industry and is overall underwhelming and slow. Most sites today use things such as PHP, Node.JS, or other more advanced and custom frameworks. Node.JS is probably the most popular currently which you could write out a service to handle things in too, you just need to make sure the host you choose supports it.
Overall I'd recommend since you are using C#, is to write WCF services as they are made for exactly what you are doing.
_________________
- Retired. |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Nov 30, 2016 9:34 pm Post subject: |
|
|
Pfft, Java all the way!
|
|
Back to top |
|
|
lolAnonymous Expert Cheater Reputation: 1
Joined: 19 Jul 2015 Posts: 154
|
Posted: Thu Dec 01, 2016 7:35 am Post subject: Reply |
|
|
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
|
Back to top |
|
|
|