Quantcast
Channel: Questions in topic: "sqldatabase"
Viewing all 146 articles
Browse latest View live

how to fix the socket exception error in unity using sql server express 2014?

$
0
0
hi, first of all thank everyone for the help, and sorry if my English is not very good. I am doing a project in unity. I made a database with sql server express 2014 and it is working fine in visual studio, but when I want to use it in unity it gives me a socket exception error. I tried to look in the internet and didn't find a solution. I am new in this world so I would like to get some help. thank you very much

issues with SQLITE DB, Getting the next data in the same column?

$
0
0
I'm trying to get the data from weapons table with just the name column and store it in the script and display it but, I am having issues getting to the next name, instead it goes straight to the last on the column? This is the SQLITE Setup for unity... I need help with making a list or array that can be used publicly from the script so I have the data to call upon and use. I am having issue with just plucking data out and specific data. Please HELP!!

Whats the best option for an item database for a single player game

$
0
0
I was going to use SQL as I know how to use it and that it can do everything I'd want it to do but I read online that you need an internet connection and to connect to a server for it to work which if true rules SQL out as I want this to be an **offline** game. I need the item database to be able to be filtered through, i.e. if an Ice enemy is killed I want them to only drop an item which has the "Ice" element or if a "gunner" is killed I'll want them to only drop a gun and/or a ice gunner dropping only items which have both the "ice" and "gun" attributes. I would also need it in separate tables/ lists so that columns which aren't applicable to different items aren't assigned a value to them. I.E. I might want in a table for bombs a column for the blast radius of the bomb, whereas obviously a helmet wouldn't have a variable for a blast radius. So it would make sense having them both in separate tables to be more efficient. **TL;DR** Should I use **SQL, XML, JSON or other** format to create my item database for an **offline** game in which the database can be **filtered through** by one or multiple different **criteria** to return a specific item and can be split into different tables relating to the different objects. I.E. if bombs need a blast radius variable and helmets don't, and there are 100 different helmets, it seems pointless and a waste of data writing out that each helmet has 0 blast radius.

Looking for step-by-step manual how to configure SQL Lite on Unity 2017 ( or other database)

$
0
0
Does anyone know where to find step-by-step manual how to configure SQL Lite on Unity 2017? Interesting in a full instruction from the beginning: 1. What SQL Light Client/Manager is better to use. 2. How to Configure it in Unity. 3. What would another type of databases you recommend to use? (Please link how to configure) Thanks a lot!

Best Server Choice for Single Player Game

$
0
0
Hello, I'm using Unity for a project I'm working on that's designed to act as a test for children on an iPad, and collect data to a server. I'm fairly new to anything networked as most of my game design experience has been on the local side, but I'm wondering which would be the best options for something that only needs a singular packet of data to be sent (various primitive types and maybe a string). Would SQL, JSON, or maybe something built-in like Photon be best to use for a one-way connection from an iPad to a server?

MSSQL 2014 Connection and Socket Exception

$
0
0
Hello friends! Need your help! I created database in MSSQLEXPRESS 2014 and trying to use this database in my Unity project. My code is below. using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Data.SqlClient; public class GObj : MonoBehaviour { public void WorkWithDatabase() { string connectionstring = @"Data Source=127.0.0.1;Initial Catalog=GameForDiplom;Integrated Security=True;"; SqlConnection Myconnection = new SqlConnection(connectionstring); Myconnection.Open(); Debug.Log("OPEN SUCCESS!"); using (var cmd = Myconnection.CreateCommand()) { cmd.CommandText = @"SELECT * FROM [User]"; using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { Debug.Log(rdr["IDuser"] + "\t" + rdr["Nickname"] + "\n"); } } } Myconnection.Close(); Debug.Log("CLOSE SUCCESS!"); } } During connection to my database in game i receive this ERROR (In English-> ***SocketException:The connection is not established, since target machine actively refused the connection request.***): ![alt text][1] [1]: /storage/temp/107643-error.png Please, I would like to see working code in C# and your settings of MSSQL EXPRESS 2014 which you use. Thank you for help, Friends!

how to connect to mssql in unity for hololesn (Build Setting Error)

$
0
0
For connecting to mssql in unity, I referred to System.Data.dll, located in C:\Program Files\Unity\Editor\Data\Mono\lib\mono\unity ( I found some blogs to recommend it, since unity can only refer to mono libraries) It was successfully operated in unity editor. However, when I did Bulid Setting for Hololens by Windows Universial Platform, error occured to warn that it could not find System.dll and mscorlib.dll. In my guess, it occured, becuase the version of C:\Program Files\Unity\Editor\Data\Mono\lib\mono\unity\System.Data.dll is 2.0, which is lower than the curretly defalut version of unity C# script 4.6. I cannot find how to solve that problem. Please, help me by giving some good advice. Thank you.

How to store data from my WEBGL game to my SQL database

$
0
0
HI, I have made a clicker game with a login system, i have used my sql database to store the user information, but i dont know what the smartest way is to store data like currency and stats is. I have experimented with creating a table to the user where all the users data would be saved but i can't get that to work. So my question is what would be the best way of storing the separately users data?

Mysql connection error when run app to webGL

$
0
0
Hello everyone, I'm trying a simple program that prints a value in the database using mysql, it works ok when I run on Unity, but it fails when I build and run it on WebGL. Could you pls help me to resovle it. Thanks. //My code: public class mysqltest { public static string connectionString ="Server=localhost;"+"Port=3306;"+"Database=samplemysqldata;"+"User ID=root;"+"Password=12345;"+"Pooling=true"; public static MySqlConnection con = new MySqlConnection(connectionString); public static IDataReader reader; public static void Connect() { if (con.State != ConnectionState.Open) con.Open (); } public static IDataReader BasicQuery(string query) { Connect (); try { using (con) { using (MySqlCommand cmd = con.CreateCommand()) { string values=""; cmd.CommandText = query; cmd.ExecuteNonQuery(); IDataReader datas = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load( datas ); // while(datas.Read()) // { // values=Convert.ToString(datas[0]); // } return dt.CreateDataReader();; } } } catch(Exception ex) { Debug.Log("Exception "+ex); return null; } } public static String getnameuser() { string query = "SELECT Objects FROM objects WHERE PercentEnd=30"; string valuies=""; IDataReader readers = BasicQuery(query); while (readers.Read()) { valuies = readers.GetString (0); } return valuies; } //get error: ![alt text][1] [1]: http://sv1.upsieutoc.com/2018/03/07/error.png

sql help with join functions

$
0
0
Write and execute a query to display the total order price for each order. Your output should include the OrderID, the quantity * price for all items + shipping, grouped by OrderID. Use appropriate column and table aliases. The total for OrderID 4 should be 138.79. ,

Unity 3d Connectivity to MS Sql Server

$
0
0
![alt text][1] [1]: /storage/temp/113534-doubt.png I'm trying to add System.Data reference but there isn't option to add the reference,Please Help.

C# WebGL I can't connect the database

$
0
0
I have this error in browser : MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MySql.Data.MySqlClient.Properties.Resources.resources" was correctly embedded or linked into assembly "MySql.Data" at compile time, or that all the satellite assemblies required are loadable and fully signed. Thank for help :)

MS SQL Database and System.Data dll

$
0
0
Hello, I've been trying to add the System.Data dll into unity so that I can use the DataTable, SqlConnection, SqlCommand, and SqlDataAdapter classes. I am using Unity 2018.1. At most, I've been successful in Unity recognizing System.Data to the point of intellisense recognizes the DataTable class. However, the imported dll either fails, or depending on the compiler I chose in the player settings, says that there is two System.Data namespaces, one being the native mono System.Data dll that is integrated with .Net 2.0 and (I think) .Net 4.X. However, mono's integrated library does not recognize System.Data.SqlClient, which is where the SqlConnection, SqlCommand, and SqlDataAdapter classes come from. The project I am working on is for a small project for data analysis, and I am used to how MS SQL works. It is perfect for what I need. Any suggestions/workarounds would be great. Thanks.

Posting to an sql database using Unity and PHP

$
0
0
Here is my c# code in unity public void addUser() { WWWForm form = new WWWForm(); form.AddField("usernamePost", username.text); form.AddField("emailPost", email.text); form.AddField("passwordPost", password.text); using (UnityWebRequest www = UnityWebRequest.Post("localhost/assassin/insertUserData.php", form)) { www.chunkedTransfer = false; test(www); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Form upload complete!"); } } } IEnumerator test(UnityWebRequest www) { yield return www.SendWebRequest(); } Here is my PHP code I get Form upload complete, but when I check my database, no new entry was added

iOS can't connect to SQLite DB

$
0
0
Hi everybody. I've a little problem. I have decided to use SQLite to save my application's data. I set up the following code to Write and delete datas by ID. (I don't need to read data, only to write and delete) When I run the application in Unity3D it works. When I build the application on my iPad or on my iPhone it doesn't work. It seeme like if it can't manage to find the database in folders. PS: I followed this tutorial to write the code and then I modified the connection string in start becouse the tutorial was made for Windows. https://www.youtube.com/watch?v=laspFwXGprg&t=101s Some Suggestions? Thanks a lot :) void Start() { //connectionString = System.IO.Path.Combine (Application.streamingAssetsPath,"MaintenanceDB.sqlite"); connectionString = "URI=file:" + Application.dataPath + "/Raw/MaintenanceDB.sqlite"; } #region SQLite Manager private string connectionString; public void Delete(){ DeleteData (GetInstanceID()); } private void InsertData(int ID, string CurrentDate, string Deadline, int Counter){ using (IDbConnection dbConnection = new SqliteConnection (connectionString)) { dbConnection.Open (); using (IDbCommand dbCmd = dbConnection.CreateCommand ()) { string sqlQuery = String.Format ("INSERT INTO Maintenance (ID,CurrentDate,Deadline,Counter) VALUES(\"{0}\",\"{1}\",\"{2}\",\"{3}\")", ID, CurrentDate, Deadline, Counter); dbCmd.CommandText = sqlQuery; dbCmd.ExecuteScalar (); dbConnection.Close (); } } } private void DeleteData(int ID){ using (IDbConnection dbConnection = new SqliteConnection (connectionString)) { dbConnection.Open (); using (IDbCommand dbCmd = dbConnection.CreateCommand ()) { string sqlQuery = String.Format ("DELETE FROM Maintenance WHERE ID =\"{0}\"",ID); dbCmd.CommandText = sqlQuery; dbCmd.ExecuteScalar (); dbConnection.Close (); } } } #endregion

PHP is not able to input data from Unity to an empty SQL

$
0
0
I have a weird thing happening with my PHP script. Currently, I have an SQL database and a simple PHP script to insert a new entry. The case is : if The PHP script is executed directly from chrome, the PHP is able to insert a new entry into SQL(even if the database is empty). if the SQL database is NOT empty, I can insert a new data entry with the same PHP script from unity (WWW request). However, when the SQL database IS empty and I try to execute the same PHP script from unity; it isn't able to create a new entry in the SQL database. have someone experience with this weird issue? please give me some idea on how to fix this problem

How do I import MySql Connector into Unity Project?

$
0
0
- I've tried placing the basic dll's into unity's assets folder - Result: "blah blah will cause Unity to Crash Error." - I've tried Manually adding references - Result: Unity refreshes its references anytime the editor refreshes, so worthless. - I've tried Installing using NuGet - Result: Closest to success as it handles all the dependencies and whatnot but I get: Assets/Scripts/Developing/TalkToDB.cs(3,7): error CS0246: The type or namespace name `MySql' could not be found. Are you missing an assembly reference? ---------- Is it some kind of a combination of "Use NuGet then copy the dll into the Assets?" or something redundant like that? cause that's about the best guess I've got. ---------- Also, I've tried a couple older versions of the NuGet package to no avail. As well, MySql.Data *is* listed under the References of "Assembly-CSharp" And my Unity is set to 4.X framework Using Unity's latest 2018.2.5f1 (64bit) (I really hope that I don't have to ditch 4.x for this to work... I'll miss initializing values to properties..)

Unity5 check database connection c#

$
0
0
Hello, I created a mysql database in xampp and unity connects to it trough php. It checks my username and password for my login system. That works fine but my question is : can I look if unity connects to the database at the setup of my c# script? So that if it does then a Cylinder should turn green and if it doesn't the cylinder should turn red.

How to call php in unity c#?

$
0
0
my php can communicate with mysql database however my c# script couldn't communicate with php.. please help me WWWForm form = new WWWForm(); form.AddField("name", _username.text); form.AddField("pass", Md5Sum(_password.text)); form.AddField("email", _email.text); form.AddField("key", Md5Sum(_username.text + secretGameKey).ToLower()); WWW www = new WWW(registerURL, form); yield return www; Debug.Log("Done!"); string _return = www.text; string _returnKey = Md5Sum(_username.text + secretServerKey).ToLower(); if (_returnKey == _return) { _msg.text = "Registration is complete"; yield return new WaitForSeconds(1); Application.LoadLevel(Application.loadedLevel); } else { _msg.text = "Server offline"+_return; _error = true; }

How to connect Unity Android app with MS SQL server

$
0
0
I am trying to build an android application from Unity to connect with a MS SQL server database. I have found some approaches that worked on editor, mostly based on directly connecting from Unity to SQL server. However, this approach does not work when I build the android app. I only need to perform "select" (to login) and "insert" (to insert session data). Can you guys give some tips on the best way to do it? In addition, I thought maybe using a web service could be necessary, but I haven't found many examples using ASP.NET as intermediary web server.
Viewing all 146 articles
Browse latest View live