How to connect SQL Server with Unity?
up vote
0
down vote
favorite
I am trying to store or retrieve an image dynamically using Unity from SQL Server. I am facing issues trying to connect to the SQL Server. How do I connect to the SQL Server?
c# sql-server unity3d
New contributor
add a comment |
up vote
0
down vote
favorite
I am trying to store or retrieve an image dynamically using Unity from SQL Server. I am facing issues trying to connect to the SQL Server. How do I connect to the SQL Server?
c# sql-server unity3d
New contributor
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to store or retrieve an image dynamically using Unity from SQL Server. I am facing issues trying to connect to the SQL Server. How do I connect to the SQL Server?
c# sql-server unity3d
New contributor
I am trying to store or retrieve an image dynamically using Unity from SQL Server. I am facing issues trying to connect to the SQL Server. How do I connect to the SQL Server?
c# sql-server unity3d
c# sql-server unity3d
New contributor
New contributor
edited yesterday
Dungeon
19511
19511
New contributor
asked yesterday
satvika Bhogavalli
1
1
New contributor
New contributor
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday
add a comment |
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Unity uses the MONO.NET framework
, which is very similar to the Microsoft.NET framework
.
This is sample code:
public void connect(){
string connectionString =
"Server=servername;" +
"Database=dbname;" +
"User ID=userid;" +
"Password=pass;" +
"Integrated Security=True";
result = new List<float> ();
resultCas = new List<DateTime> ();
using(SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand c; SqlDataReader da; SqlParameter param1; SqlParameter param2; SqlParameter param3; SqlParameter param4;
conn.Open();
c = new SqlCommand();
c.Connection = conn;
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "commandtext";
param1 = c.Parameters.Add("@identify",SqlDbType.Int);
param1.Value = 1;
param2 = c.Parameters.Add("@startTime",SqlDbType.DateTime);
param2.Value = "2010-11-10 07:45:00.000";
param3 = c.Parameters.Add("@endTime",SqlDbType.DateTime);
param3.Value = "2010-11-12 10:15:00.000";
param4 = c.Parameters.Add("@args",SqlDbType.NVarChar);
param4.Value = "I";
da = c.ExecuteReader();
while (da.Read())
{
resultCas.Add(da.GetDateTime(0));
result.Add((float)da.GetDouble(1));
}
}
}
From Unity, use the WWW
or UnityWebRequest
class to communicate with that script and then, you will be able to send and receive information from Unity to the server. There are many examples out there.
You can also receive data multiple with json
.
Visit this complete example from this Unity wiki. It shows how to interact with a database in Unity using php
and C#
on the server side and Unity
on the client side.
Hope it Helps.Thanks!
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Unity uses the MONO.NET framework
, which is very similar to the Microsoft.NET framework
.
This is sample code:
public void connect(){
string connectionString =
"Server=servername;" +
"Database=dbname;" +
"User ID=userid;" +
"Password=pass;" +
"Integrated Security=True";
result = new List<float> ();
resultCas = new List<DateTime> ();
using(SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand c; SqlDataReader da; SqlParameter param1; SqlParameter param2; SqlParameter param3; SqlParameter param4;
conn.Open();
c = new SqlCommand();
c.Connection = conn;
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "commandtext";
param1 = c.Parameters.Add("@identify",SqlDbType.Int);
param1.Value = 1;
param2 = c.Parameters.Add("@startTime",SqlDbType.DateTime);
param2.Value = "2010-11-10 07:45:00.000";
param3 = c.Parameters.Add("@endTime",SqlDbType.DateTime);
param3.Value = "2010-11-12 10:15:00.000";
param4 = c.Parameters.Add("@args",SqlDbType.NVarChar);
param4.Value = "I";
da = c.ExecuteReader();
while (da.Read())
{
resultCas.Add(da.GetDateTime(0));
result.Add((float)da.GetDouble(1));
}
}
}
From Unity, use the WWW
or UnityWebRequest
class to communicate with that script and then, you will be able to send and receive information from Unity to the server. There are many examples out there.
You can also receive data multiple with json
.
Visit this complete example from this Unity wiki. It shows how to interact with a database in Unity using php
and C#
on the server side and Unity
on the client side.
Hope it Helps.Thanks!
add a comment |
up vote
0
down vote
Unity uses the MONO.NET framework
, which is very similar to the Microsoft.NET framework
.
This is sample code:
public void connect(){
string connectionString =
"Server=servername;" +
"Database=dbname;" +
"User ID=userid;" +
"Password=pass;" +
"Integrated Security=True";
result = new List<float> ();
resultCas = new List<DateTime> ();
using(SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand c; SqlDataReader da; SqlParameter param1; SqlParameter param2; SqlParameter param3; SqlParameter param4;
conn.Open();
c = new SqlCommand();
c.Connection = conn;
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "commandtext";
param1 = c.Parameters.Add("@identify",SqlDbType.Int);
param1.Value = 1;
param2 = c.Parameters.Add("@startTime",SqlDbType.DateTime);
param2.Value = "2010-11-10 07:45:00.000";
param3 = c.Parameters.Add("@endTime",SqlDbType.DateTime);
param3.Value = "2010-11-12 10:15:00.000";
param4 = c.Parameters.Add("@args",SqlDbType.NVarChar);
param4.Value = "I";
da = c.ExecuteReader();
while (da.Read())
{
resultCas.Add(da.GetDateTime(0));
result.Add((float)da.GetDouble(1));
}
}
}
From Unity, use the WWW
or UnityWebRequest
class to communicate with that script and then, you will be able to send and receive information from Unity to the server. There are many examples out there.
You can also receive data multiple with json
.
Visit this complete example from this Unity wiki. It shows how to interact with a database in Unity using php
and C#
on the server side and Unity
on the client side.
Hope it Helps.Thanks!
add a comment |
up vote
0
down vote
up vote
0
down vote
Unity uses the MONO.NET framework
, which is very similar to the Microsoft.NET framework
.
This is sample code:
public void connect(){
string connectionString =
"Server=servername;" +
"Database=dbname;" +
"User ID=userid;" +
"Password=pass;" +
"Integrated Security=True";
result = new List<float> ();
resultCas = new List<DateTime> ();
using(SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand c; SqlDataReader da; SqlParameter param1; SqlParameter param2; SqlParameter param3; SqlParameter param4;
conn.Open();
c = new SqlCommand();
c.Connection = conn;
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "commandtext";
param1 = c.Parameters.Add("@identify",SqlDbType.Int);
param1.Value = 1;
param2 = c.Parameters.Add("@startTime",SqlDbType.DateTime);
param2.Value = "2010-11-10 07:45:00.000";
param3 = c.Parameters.Add("@endTime",SqlDbType.DateTime);
param3.Value = "2010-11-12 10:15:00.000";
param4 = c.Parameters.Add("@args",SqlDbType.NVarChar);
param4.Value = "I";
da = c.ExecuteReader();
while (da.Read())
{
resultCas.Add(da.GetDateTime(0));
result.Add((float)da.GetDouble(1));
}
}
}
From Unity, use the WWW
or UnityWebRequest
class to communicate with that script and then, you will be able to send and receive information from Unity to the server. There are many examples out there.
You can also receive data multiple with json
.
Visit this complete example from this Unity wiki. It shows how to interact with a database in Unity using php
and C#
on the server side and Unity
on the client side.
Hope it Helps.Thanks!
Unity uses the MONO.NET framework
, which is very similar to the Microsoft.NET framework
.
This is sample code:
public void connect(){
string connectionString =
"Server=servername;" +
"Database=dbname;" +
"User ID=userid;" +
"Password=pass;" +
"Integrated Security=True";
result = new List<float> ();
resultCas = new List<DateTime> ();
using(SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand c; SqlDataReader da; SqlParameter param1; SqlParameter param2; SqlParameter param3; SqlParameter param4;
conn.Open();
c = new SqlCommand();
c.Connection = conn;
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "commandtext";
param1 = c.Parameters.Add("@identify",SqlDbType.Int);
param1.Value = 1;
param2 = c.Parameters.Add("@startTime",SqlDbType.DateTime);
param2.Value = "2010-11-10 07:45:00.000";
param3 = c.Parameters.Add("@endTime",SqlDbType.DateTime);
param3.Value = "2010-11-12 10:15:00.000";
param4 = c.Parameters.Add("@args",SqlDbType.NVarChar);
param4.Value = "I";
da = c.ExecuteReader();
while (da.Read())
{
resultCas.Add(da.GetDateTime(0));
result.Add((float)da.GetDouble(1));
}
}
}
From Unity, use the WWW
or UnityWebRequest
class to communicate with that script and then, you will be able to send and receive information from Unity to the server. There are many examples out there.
You can also receive data multiple with json
.
Visit this complete example from this Unity wiki. It shows how to interact with a database in Unity using php
and C#
on the server side and Unity
on the client side.
Hope it Helps.Thanks!
answered yesterday
Dungeon
19511
19511
add a comment |
add a comment |
satvika Bhogavalli is a new contributor. Be nice, and check out our Code of Conduct.
satvika Bhogavalli is a new contributor. Be nice, and check out our Code of Conduct.
satvika Bhogavalli is a new contributor. Be nice, and check out our Code of Conduct.
satvika Bhogavalli is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405220%2fhow-to-connect-sql-server-with-unity%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
First of all try your own code, and if you have any problem, put your code here.
– Siavash
yesterday
I think Unity can't be used for that purpose, something else will be needed for getting the data from SqlServer and then use that data with Unity. As an example there's SqlConnection class docs.microsoft.com/en-us/dotnet/api/…
– rvazquezglez
yesterday
A minimal complete and verifiable example would really help
– Fabjan
yesterday