On Wed, Apr 8, 2009 at 8:57 AM, Wesley Chen <cjq.999 / gmail.com> wrote:
> Hi, Sean,
> Thank you very much.
>
> I have tried following your advice.
> In the connection string below, I replace the *@host* with the format
> *myServerName\the
> InstanceName* or *myServerName\\the InstanceName*
> I can't succeed.
> On local machine, when the @host is just an IP address, I can succeed.
>
> connection_string = "Provider=SQLOLEDB.1;"
> connection_string << "Persist Security Info=False;"
> connection_string << "User ID=#{@username};"
> connection_string << "password=#{@password};"
> connection_string << "Initial Catalog=#{database};"
> connection_string << "Data Source=#{*@host*}, 1433;"

Did you try

   connection_string << "Server=myServerName\\theInstanceName"

I'm not sure this is right:

> connection_string << "Data Source=#{*@host*}, 1433;"

As far as I remember, named instances won't be running on port 1433.

Regards,
Sean