Search Unity

Unity 4 +Miscrosoft Sql server 2012

Discussion in 'Scripting' started by matrixii, Jan 21, 2013.

  1. matrixii

    matrixii

    Joined:
    Mar 12, 2012
    Posts:
    36
    i ve the correctly setup microsoft sql server 2012 in unity 4...i ve complied the solution with microsoft net framwoek 2.0(not the subset) .the communication with sql server work with tpc/ip connection,with this connection string:
    server = "Server=MARIANO-PC\\SQLEXPRESS;";

    dbname = "Database=DbAlphaTest;";
    connectionString = server + dbname+"User ID=usid;"+"Password=pass;";
    ..
    ...
    public void AddUsers()
    {
    Debug.Log(connectionString);
    //conn = new SqlConnection(connectionString);

    using (SqlConnection conn = new SqlConnection(connectionString))
    {
    try
    {
    conn.Open();
    string select = "SELECT * FROM Users";
    SqlCommand cm = new SqlCommand(select, conn);
    SqlDataReader dr = cm.ExecuteReader();
    while (dr.Read())
    {
    Users usr = new Users(dr[1].ToString(), dr[2].ToString(), (bool)dr[3]);
    ConnectedUsers.Add(usr);


    }


    }
    catch (Exception ex)
    {

    Debug.Log(ex.Message);
    }
    finally
    {
    conn.Close();
    }

    }
    }
    ...now in my editor all work fine...but when i compile in exe ....don't work...(i ve included also the using System.Data,System.Data.SqlClient dll in the editor folder and project folder.....)no result after bulild....any hint?
     
  2. shaderop

    shaderop

    Joined:
    Nov 24, 2010
    Posts:
    942
    "Don't work" isn't very descriptive. What kind of error are you getting? Is the program throwing any exceptions?
     
  3. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    Does the .dll need to go in the plugins folder? I know very little about it but was just reading about it recently.
     
  4. GaVaR

    GaVaR

    Joined:
    Jan 21, 2013
    Posts:
    9
    Do you have provider specified in machine.config?

    Check the machine.config in the "your_game"_data folder.
     
  5. matrixii

    matrixii

    Joined:
    Mar 12, 2012
    Posts:
    36
    No errors in the editor but whan i try to launch the compiled exe the label with databases data donesn't appear
     
  6. matrixii

    matrixii

    Joined:
    Mar 12, 2012
    Posts:
    36
    Config file ::
    Platform assembly: C:\Users\Mariano\Documents\Unity Project\MyMMOServer\Build\b01_Data\Managed\System.Data.dll (this message is harmless)
    Platform assembly: C:\Users\Mariano\Documents\Unity Project\MyMMOServer\Build\b01_Data\Managed\System.dll (this message is harmless)
    Server=MARIANO-PC\SQLEXPRESS;Database=DbAlphaTest;User ID=uid;Password=pass;

    (Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 43)

    Platform assembly: C:\Users\Mariano\Documents\Unity Project\MyMMOServer\Build\b01_Data\Managed\System.EnterpriseServices.dll (this message is harmless)
    CodePage 1252 not supported

    (Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 43)

    0

    (Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 43)
     
  7. GaVaR

    GaVaR

    Joined:
    Jan 21, 2013
    Posts:
    9
    So maybe you not calling it? It would become more clear if you provide more code where you call it and how.
     
  8. matrixii

    matrixii

    Joined:
    Mar 12, 2012
    Posts:
    36
    Ok solved i discover an error when i launch the EXE codepage 1252 not supported.
    i've included i18n.dll and i18nwest.dll in my plugin folder(in the same directory of system data.dll) ...now sql server and unity 4 work fine )