Jump to content

I need help with setting up database for c# program

So I am making simple game with cards in c# with visual studio and it's first time that I am trying to make database that would connect to host's game and game on another computer on lan.and I am having problems with it.

 

So far i have been only testing it on one computer, but it didn't work when i used ip like:

dataConnection.ConnectionString = @"server=" + Variables.ip + @"\v11.0;AttachDbFilename=C:\multiplayer\multiplayer\Database2.mdf;Integrated Security=True";

 

but worked when used like this;

dataConnection.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\multiplayer\multiplayer\Database2.mdf;Integrated Security=True";

 

I have been googling my problems and it said that i have to enable remote conections, but i am not sure how to do that.

 

so if you have any idea how i could do it, i would be so thankfull.

Link to post
Share on other sites

So I am making simple game with cards in c# with visual studio and it's first time that I am trying to make database that would connect to host's game and game on another computer on lan.and I am having problems with it.

 

So far i have been only testing it on one computer, but it didn't work when i used ip like:

dataConnection.ConnectionString = @"server=" + Variables.ip + @"\v11.0;AttachDbFilename=C:\multiplayer\multiplayer\Database2.mdf;Integrated Security=True";

 

but worked when used like this;

dataConnection.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\multiplayer\multiplayer\Database2.mdf;Integrated Security=True";

 

I have been googling my problems and it said that i have to enable remote conections, but i am not sure how to do that.

 

so if you have any idea how i could do it, i would be so thankfull.

A database isn't what you want here, it's not really practical.

 

You would want a master server that it communicates with both clients and that master server can store data flatfile, mysql, array, whatever.

 

https://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient%28v=vs.90%29Poke around there and learn a bit (don't worry, sockets aren't difficult to learn, you're only sending an array of bytes)

 

Any particular reason you chose C# as your choice of language?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×