The problem is opening the connection. Presumably, whatever process is
running the ASP, is not configured to be a user in the database.
Either make that process a user on the database (which may be hard if it is
a local account, and the server is on a different machine), or pass in a
username/password to connect.
Code blocks like that should be in a Try/Catch anyway, so that your function
can deal with connection issues, as well as query execution issues.
Additionally, I recommend you use Option Strict On, and force your function
to have a return type. It just makes things more readable, and often catches
coding errors at compile time.
And last (but certainly not least), you are never closing the connection or
the reader at the end of your function. This is a big no-no. You will end up
with a connection leak.
> Dear Friends,
>
[quoted text clipped - 80 lines]
>
> Can anyone help me?
Robson Carvalho Machado - 30 Sep 2005 17:05 GMT
Dear Marina,
Thanks for you comments:
I've tryed to change connection string to
strConnect = "Provider=SQLOLEDB;Server" + server + ";Database=" +
database + ";uid=myuser;pwd=password"
even after this the problem shows itself the same way.
Best regards.
Robson Machado
> The problem is opening the connection. Presumably, whatever process is
> running the ASP, is not configured to be a user in the database.
[quoted text clipped - 98 lines]
> >
> > Can anyone help me?
Marina - 30 Sep 2005 17:27 GMT
There is still some problem connecting.
Try running your code from a .NET app, see what happens.
Also, put your code in a Try/Catch, and return the error message of the
exception, so that your ASP page can display it.
> Dear Marina,
>
[quoted text clipped - 128 lines]
>> >
>> > Can anyone help me?