Click here to Skip to main content
15,849,829 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i'm begin program sql database and set all of option the application connect to local database but when it want connect to remote computer randomize 2 error occured.
1-data base could not opened
2-error 26
i use virtual machine for simulate lan and use windows XP SERVISE2
i setup a project and install it in 2 windows
i think my problem from my connection string;
my connection is:
SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename="+Sourcelocationtxt.Text+"\\Database1.mdf;Integrated Security=True;User Instance=True");
is it true???????
what you recommend me to connection string?
can you type for me a true connection string?

thank's as you
I very hurry
Posted
Comments
Dylan Morley 17-Aug-10 9:30am    
Excellent website for connection strings is http://www.connectionstrings.com/
Niklas L 17-Aug-10 9:31am    
http://www.connectionstrings.com/ is a great source for connection strings.

1 solution

If you are new to sql this is a good site.

http://www.asp.net/sql-server/videos[^]
 
Share this answer
 
Comments
X-ahmad 19-Aug-10 21:38pm    
Reason for my vote of 3
thank's dear
but if you can write for me a connection string that can connected to remote computer or upload for me a simple project that can connected to the server computer
thank's
Per Söderlund 20-Aug-10 1:47am    
If you use visual studio you can add datasource in the data menu, there you can Test your connection, Visual studio will generate a valid connection string.It´s good to test cause if you are doing this over LAN you have to configure Server side software for it.

I can´t see any obvious error in your connection string.
Maybe you can try and change
"AttachDbFilename="+Sourcelocationtxt.Text+"\Database1.mdf;"
into
"Initial Catalog="Database1.mdf;"
But that is just a guess.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900