Is your database attached to SQL Server? If not you will have to attach teh
file first. There may be a connection string option that connects the file,
but I don't know what it is offhand.
Now, the connection string isn't tested until you call conn.Open() I don't
think, try calling the open method on your connection object and seeing what
exception is thrown, then post back.
"djozy" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Please,I have made database in Sql server. How to connect
with it? It is,lets say,in C:\temp and its name is
database1. What do I need to put here:
SqlConnection conn=new SqlConnection("Data
Source=localhost;User Id=sa;Password=pwd;Initial
Catalog=database1;");?
When I put this it doesn't work. When I put whatever it
doesn't work and it doesn't show error message.
Tahnk you