Thursday, 22 March 2012

Connect to Local

Hey Guys,

I have a SQL connection string question. In my web.config I don't know what to put for the server. I have SQL Server 2005 installed locally.

<connectionStrings>
<add name="database" providerName="System.Data.SqlClient" connectionString= "server=whatgoeshere?;database=test;uid=sa;pwd=password" />
</connectionStrings>

I'm using VS 2005.

Thanks in advance.

-Marc

Try:
(local)

|||

thanks for the reply.

I'm trying to see if the connection string works using "local" but I'm having trouble with my code.

When I add this line: Dim sqlConn as new SQLconnection the "SQLconnection" errors.

I've tried importing SQL at the top but still doesn't work. Is there some reference I need to add?

Thanks.

|||

C# is case sensitive.

It should be Dim sqlConn as new SqlConnection();

|||

I'm actually using VB.

On this line: Dim SqlConn as New SqlConnection() the "SqlConnection()" has the blue line under it indicating an error.

I'm trying to figure out if I need to Import a namespace or maybe when I installed VS2005 I did something wrong.

Thanks.

|||

Try importing:
System.Data.SQLClient

|||

augustwind thanks for the help... it works. Using local for the db and using the import you suggested.

I have a quick question that you might be able to anwer. It VS 2003 whenever I would create a new proj it would store it in the C:\Inetpub\wwwroot blah blah blah. But when I create a new proj in VS2005 it saves it somewhere else. Do you know why that is?

Thanks again.

|||

Sorry - I know where - but I don't know why - -

Big Smile

No comments:

Post a Comment