Connecting to SQL Server with UnityConnection timeout for SQL serverUnity 3D connection to (MS)SQL serverConnect to a web server with UnityHow to prepare a Unity project for git?Connecting Unity with SQL serverUnity GUIText on Collision c#Unity/C# - Connect to Unity Server on another computerConnecting Unity with SQL Server DatabaseUnity - Connect to a server with UDPHow to connect SQL Server with Unity?

whey we use polarized capacitor?

LED on same Pin as Toggle Switch, not illuminating

Can a German sentence have two subjects?

What is the meaning of "of trouble" in the following sentence?

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Is there really no realistic way for a skeleton monster to move around without magic?

The use of multiple foreign keys on same column in SQL Server

Could a US political party gain complete control over the government by removing checks & balances?

What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?

N.B. ligature in Latex

Copycat chess is back

Simulate Bitwise Cyclic Tag

Shell script can be run only with sh command

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Can I make popcorn with any corn?

What are these boxed doors outside store fronts in New York?

Why CLRS example on residual networks does not follows its formula?

Prevent a directory in /tmp from being deleted

Motorized valve interfering with button?

Schwarzchild Radius of the Universe

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?

Is there a familial term for apples and pears?

Should I join an office cleaning event for free?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)



Connecting to SQL Server with Unity


Connection timeout for SQL serverUnity 3D connection to (MS)SQL serverConnect to a web server with UnityHow to prepare a Unity project for git?Connecting Unity with SQL serverUnity GUIText on Collision c#Unity/C# - Connect to Unity Server on another computerConnecting Unity with SQL Server DatabaseUnity - Connect to a server with UDPHow to connect SQL Server with Unity?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to connect to SQL Server with unity. I have done this many times before but not on unity. It says completed but the data is not inserted. I have already added the System.Data.dll to my project assets. My goal is to insert user inputs from inputfield into the database. Please my code below and I will appreciate any help. Thank You.



Output:




SocketException: The operation completed successfully.




My code:



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Data;
using System.Data.SqlClient;

public class DbConn : MonoBehaviour

public InputField username;
public InputField score;
public Text ftext;
public string connectionstring;

// button action
public void Onclick()

// SQL Server connection
connectionstring = @"Data Source = servername; Initial Catalog = NewtonGame; User ID = username; Password = [password];";
string sql = "insert into Playerscore(username, score) values (@username, @score); ";

using (var sqlCon = new SqlConnection(connectionstring))
using (var cmd = new SqlCommand(sql, sqlCon))

cmd.Parameters.AddWithValue("@username", username.text);
cmd.Parameters.AddWithValue("@score", score.text);

sqlCon.Open();
cmd.ExecuteNonQuery();












share|improve this question
























  • What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

    – mason
    Mar 22 at 1:42











  • This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

    – NAHEEM OLANIYAN
    Mar 22 at 2:22






  • 1





    Did you add logging statements to see if the code finishes or even gets reached?

    – mason
    Mar 22 at 4:11

















0















I am trying to connect to SQL Server with unity. I have done this many times before but not on unity. It says completed but the data is not inserted. I have already added the System.Data.dll to my project assets. My goal is to insert user inputs from inputfield into the database. Please my code below and I will appreciate any help. Thank You.



Output:




SocketException: The operation completed successfully.




My code:



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Data;
using System.Data.SqlClient;

public class DbConn : MonoBehaviour

public InputField username;
public InputField score;
public Text ftext;
public string connectionstring;

// button action
public void Onclick()

// SQL Server connection
connectionstring = @"Data Source = servername; Initial Catalog = NewtonGame; User ID = username; Password = [password];";
string sql = "insert into Playerscore(username, score) values (@username, @score); ";

using (var sqlCon = new SqlConnection(connectionstring))
using (var cmd = new SqlCommand(sql, sqlCon))

cmd.Parameters.AddWithValue("@username", username.text);
cmd.Parameters.AddWithValue("@score", score.text);

sqlCon.Open();
cmd.ExecuteNonQuery();












share|improve this question
























  • What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

    – mason
    Mar 22 at 1:42











  • This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

    – NAHEEM OLANIYAN
    Mar 22 at 2:22






  • 1





    Did you add logging statements to see if the code finishes or even gets reached?

    – mason
    Mar 22 at 4:11













0












0








0








I am trying to connect to SQL Server with unity. I have done this many times before but not on unity. It says completed but the data is not inserted. I have already added the System.Data.dll to my project assets. My goal is to insert user inputs from inputfield into the database. Please my code below and I will appreciate any help. Thank You.



Output:




SocketException: The operation completed successfully.




My code:



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Data;
using System.Data.SqlClient;

public class DbConn : MonoBehaviour

public InputField username;
public InputField score;
public Text ftext;
public string connectionstring;

// button action
public void Onclick()

// SQL Server connection
connectionstring = @"Data Source = servername; Initial Catalog = NewtonGame; User ID = username; Password = [password];";
string sql = "insert into Playerscore(username, score) values (@username, @score); ";

using (var sqlCon = new SqlConnection(connectionstring))
using (var cmd = new SqlCommand(sql, sqlCon))

cmd.Parameters.AddWithValue("@username", username.text);
cmd.Parameters.AddWithValue("@score", score.text);

sqlCon.Open();
cmd.ExecuteNonQuery();












share|improve this question
















I am trying to connect to SQL Server with unity. I have done this many times before but not on unity. It says completed but the data is not inserted. I have already added the System.Data.dll to my project assets. My goal is to insert user inputs from inputfield into the database. Please my code below and I will appreciate any help. Thank You.



Output:




SocketException: The operation completed successfully.




My code:



using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Data;
using System.Data.SqlClient;

public class DbConn : MonoBehaviour

public InputField username;
public InputField score;
public Text ftext;
public string connectionstring;

// button action
public void Onclick()

// SQL Server connection
connectionstring = @"Data Source = servername; Initial Catalog = NewtonGame; User ID = username; Password = [password];";
string sql = "insert into Playerscore(username, score) values (@username, @score); ";

using (var sqlCon = new SqlConnection(connectionstring))
using (var cmd = new SqlCommand(sql, sqlCon))

cmd.Parameters.AddWithValue("@username", username.text);
cmd.Parameters.AddWithValue("@score", score.text);

sqlCon.Open();
cmd.ExecuteNonQuery();









asp.net unity3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 5:11









marc_s

584k13011241270




584k13011241270










asked Mar 22 at 1:00









NAHEEM OLANIYANNAHEEM OLANIYAN

485




485












  • What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

    – mason
    Mar 22 at 1:42











  • This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

    – NAHEEM OLANIYAN
    Mar 22 at 2:22






  • 1





    Did you add logging statements to see if the code finishes or even gets reached?

    – mason
    Mar 22 at 4:11

















  • What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

    – mason
    Mar 22 at 1:42











  • This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

    – NAHEEM OLANIYAN
    Mar 22 at 2:22






  • 1





    Did you add logging statements to see if the code finishes or even gets reached?

    – mason
    Mar 22 at 4:11
















What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

– mason
Mar 22 at 1:42





What do you mean it says "completed"? Did you try debugging the code? Did you add logging statements to see if it finishes?

– mason
Mar 22 at 1:42













This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

– NAHEEM OLANIYAN
Mar 22 at 2:22





This is the output I got in unity console SocketException: The operation completed successfully. I cant debug unity code on Visual Studio.

– NAHEEM OLANIYAN
Mar 22 at 2:22




1




1





Did you add logging statements to see if the code finishes or even gets reached?

– mason
Mar 22 at 4:11





Did you add logging statements to see if the code finishes or even gets reached?

– mason
Mar 22 at 4:11












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55291409%2fconnecting-to-sql-server-with-unity%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55291409%2fconnecting-to-sql-server-with-unity%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript