Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Connection problem from asp page - invalid object

Status
Not open for further replies.

GML101

Programmer
Jul 23, 2007
2
Hi

There has to be a simple answer to this one

I am upgrading a web site to asp net and SQLserver but want to keep the asp forms I have on the site which are essentially driven by hyperlinks from Grid View data

When i sign on to the site I have no problems running sql select statements on the asp net pages and getting the result i require

However when I hyperlink to the asp form,it is required to connect to the same database table and collect the data to complete the form

Herein lies the problem - using the following connection string and many variants of it
ASP Code
<%Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("customer_ConnectionString")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = Conn
strSQL = ("SELECT * FROM Test")
rs.open strSQL
%>

I get - [SQL Server]Invalid object name 'Test'.(DB table)

The actual connection string is "Driver={sql native client};Data source=GML" where the GML is a system DSN designed to replicate the following and it tests OK

if i use this connection string instead of the DSN
"Driver={SQL Native Client};Server=machinename\sqlexpress;Database=customer;integrated security=yes;"
And the path to the data base is given or not

I get -Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
As both strings seem identical - What is the problem?

Connection strings are held in global.asa

Having said this the DSN string does seem to get me to the database but not the table

There is nothing wrong with the select statements (checked in analyzer)

Suffice to say the site works fine in ASP/Access but I have this problem with ASPNET/SQLSERVER/ASP

Sorry the question is so long - but pls could some-one point me in the right direction to get the SQLserver connection from an ASP page that I get from an ASPNET page

If it is a permissions problem - why does it work aspnet-sql and not asp - sql

Thanks



 
What is the default db for the user account that you are trying to use. I didn't see where you specified the db so it is most likely trying to find the object Test in the master db.

- Paul
- If at first you don't succeed, find out if the loser gets anything.
 
Thanks for coming back

The database is customer as shown in the full connection string

When I created the DSN using Data Sources ODBC this database did not come up as a choice and I had to type the choice in - but it tested ok

Database and tables clearly show on Service Management studio express

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top