Calvin Ruka
Calvin Ruka

Reputation: 11

Connection string is not working

DB="Source={SQL Server};Server=CALVINRUKA-PC\SQLCALVIN;DataSource=DWDSCal\Tables;Uid=sa;PWD=;Trusted-Connection=Yes;"

I using SQL Server 2008 R2 to connect with HTML page. I trying to connect HTML page with login to SQL Database. I have try called the Source but didnt work.

Upvotes: 0

Views: 151

Answers (2)

Rory McCrossan
Rory McCrossan

Reputation: 337700

As you've said you're using SQL Server 2008 R2, try using a connection string in this format:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

Also ensure that you've enabled SQL Server and Windows Authentication mode in your SQL Server settings.

Upvotes: 1

Rubens Farias
Rubens Farias

Reputation: 57996

To create a valid connection string, you can:

  • Create an empty text file, named connection.udl
  • Double-click it
  • Enter your server name
  • Select "Allow saving password" and fill other data
  • Select your database
  • Click "Test connection" button
  • If everything is ok, click ok and confirm saving password
  • Open this file in Notepad

For ASP.NET, you will use everything except Provider=SQLOLEDB.1;

Upvotes: 0

Related Questions