0
votes

Hi I created a C# winforms application, I added a connection with my database which I created in Sql Server 2008 Express in Management Studio. I published the project and everything seems to be working fine in my computer, but when i ran the setup in another computer, the program had stopped working and showed this message error. I want the application to run in any computer.

Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: geography.exe Problem Signature 02: 1.0.0.0 Problem Signature 03: 525520ed Problem Signature 04: System.Data Problem Signature 05: 4.0.30319.17929 Problem Signature 06: 4ffa5c76 Problem Signature 07: 2592 Problem Signature 08: 27 Problem Signature 09: System.Data.SqlClient.Sql OS Version: 6.1.7600.2.0.0.256.1 Locale ID: 1032 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

My connection string is Data Source=.\sqlexpress;Initial Catalog=geografia;Integrated Security=True

I changed it to Data Source=(local)\sqlexpress;Initial Catalog=geografia;Integrated Security=True but still the same result.

Then i tried to catch the error with a try catch block in the first database connection and when i ran the program it showed me cannot open database "geografia" requested by the login. The login failed. Login failed for user 'pcname-PC\username'.

When I was publishing the application I included geography.pdb as data file (geography is the name of my project and I don't know if thatis for embedding the database)

I am new to programming and I don't know if I attached my database in the application.

I read some stuff but i am a bit confused. Is there any idea?

3
First thing to be aware of integrated security only works between multiple PCs if they are on a domain, because the windows users on PC2 have no Relation to the Windows users on PC1. - Ben Robinson
Try the hostname of your instead of localhost, hostname\sqlexpress - Ofiris
I want it to run in any computer, so what would be the appropriate hostname? - user224447
As far as I know .pdb is file containing debug symbols. You need a real database, if you're going to distribute database file with your application, try SQL Compact, it has .sdf files - Robert

3 Answers

0
votes

change the connection string with proper server name

Data Source=<serrvername>\sqlexpress;Initial Catalog=geografia;Integrated Security=True

If you are using (local) or DOT(.) It means that it has to connect to computer in which application is running. In this case if you dont have sql server or database installed on different computer it will throw this error.

0
votes

Since your application is working fine on your computer when having dot(.), you can use servername as your machine name.

Also instead of using Integrated security, try using username and password of Sql Server.

-1
votes

Your problem is how you attach to your database

  • If your database is attached with window authentication this will from your machine only unless you are on a domain
  • If your attached database with SQL server authentication this will from any computer.

Observations : attach to your database with SQL server not with database SQL server file. If you choose database file, you can't connect to machine with your database SQL server