Sql Connection Not working

T

tshad

I have the following VS2003 code where I am getting an error on the Sql
Connection that is on the same machine.

My code snippet is:

**********************************
Imports System
Imports System.Data
Imports System.Data.SqlClient
....

Public Function AddUser() As Boolean
Dim dbReader As SqlDataReader
Dim objConn As SqlConnection
Dim ConnectionString As String = "DON\AW_INSTANCE;Initial Catalog=Irez;User
ID=xxx;Password=yyy;"
Try
objConn = New SqlConnection(ConnectionString)
Catch ex As Exception
Console.WriteLine("Error at connection with connection = {0}",
ex.Message)
End Try
***********************************

At the objConn = New SqlConnection line I am getting an exception:

"Keyword not supported: 'don\aw_instance;initial catalog'."

This is the same Connection string I have in my web.config file for my web
page and that works fine.

This is in a program I am building and both program and web site are on the
same machine as the Sql Server.

What would cause this problem?

Thanks,

Tom
 
T

tshad

Never mind.

I found it.

I didn't copy the whole connection string from the Web.Config file. I left
out:

Persist Security Info=False;Data Source=

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top