Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tal770 · Jan 09, 2012 at 11:47 AM · databaseconnect

cannot connect database sdf compact version of MSSQL

I created a local database database.sdf and places it at the assets folder and tried to connect to it connectin string: string connectionString ="Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\\Database1.sdf;Persist Security Info=False";

trying to open and use it SqlConnection conn = new SqlConnection(connectionString); string sqlIns = "INSERT INTO Shelf (row,colume,depth,shelfType,isEmpty) VALUES (@row, @colume, @depth, @shelfType, @isEmpty)"; conn.Open(); try { SqlCommand cmdIns = new SqlCommand(sqlIns); cmdIns.Parameters.AddWithValue("@row", shelf.row); cmdIns.Parameters.AddWithValue("@colume", shelf.colume); cmdIns.Parameters.AddWithValue("@depth", shelf.depth); cmdIns.Parameters.AddWithValue("@shelfType", shelf.shelfType); cmdIns.Parameters.AddWithValue("@isEmpty", shelf.empty); cmdIns.ExecuteNonQuery(); cmdIns.Dispose(); cmdIns = null; } catch (Exception SockEx) { Debug.Log("Socket exception: " + SockEx.Message); }

       finally
       {
            conn.Close();
       }
 I get SocketException:
 SocketException: ‏‏לא מוכר מחשב מערך כזה.

System.Net.Dns.GetHostByName (System.String hostName) System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) System.Net.Dns.GetHostAddresses (System.String hostNameOrAddress) System.Net.Sockets.UdpClient.Connect (System.String hostname, Int32 port) System.Net.Sockets.UdpClient..ctor (System.String hostname, Int32 port) System.Data.SqlClient.SqlConnection+SqlMonitorSocket..ctor (System.String ServerName, System.String InstanceName) System.Data.SqlClient.SqlConnection.DiscoverTcpPortViaSqlMonitor (System.String ServerName, System.String InstanceName) System.Data.SqlClient.SqlConnection.ParseDataSource (System.String theDataSource, System.Int32& thePort, System.String& theServerName) System.Data.SqlClient.SqlConnection.Open () (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlConnection:Open () consol_manager.isShelf_empty (Int32 row, Int32 colume, Int32 depth) (at Assets/Scripts/consol_manager.cs:177) setEmptyTrays.Awake () (at Assets/Scripts/setEmptyTrays.cs:23)

unrecognized host tried spacifing direct address and it want work I googled and found that to use the sdf file I should use SqlCeConnection but its not on system.data any help?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Tal770 · Jan 09, 2012 at 05:45 PM

To be more readable

  1. created database.sdf file and placed it at the assest folder/

  2. on db.open() i receive a socketException

  3. I think becuse its a compact version of mssql and I should use SqlCeConnection but thats not included in the system.data

any help plase

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Tal770 · Jan 09, 2012 at 06:03 PM

  1. a direct pointing to the database1.sdf file

  2. Data Source=C:/Users/MMS/Documents/AVM Project/Assets/Database1.sdf;Persist Security Info=Fals

  3. the db.open() and the exception "unkown host" message

SocketException: ‏‏לא מוכר מחשב מערך כזה.

System.Net.Dns.GetHostByName (System.String hostName) System.Net.Dns........... etc

  1. the connect string is pointing at the database file and still it wont work

  2. googling it says that I should use SqlCeConnect insted of SqlConnect for compact database

  3. any body tried this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

mystery MYSQL error .. 2 Answers

Not allowed to connect to my database. 1 Answer

Best way to connect to database for my mobile game? 3 Answers

Connect to MySQL Database with Unity using Hamachi 1 Answer

How to connect a mobile app to an online database? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges