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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

quick and dirty database connections

Status
Not open for further replies.

uncleroydee

Technical User
Nov 28, 2000
79
US
I'm not a web developer and I don't play one on TV ;-) (I'm more of a database kind of guy.)

I am having trouble figuring out how to make the pages in my project interact with the SQL Server database. I've got the ODBC connection correct, I create a database project within the web project but I can't seem to make the pages in the web project display data from the database.

I know I'm probably missing a simple step, but it's startin to tick me off.

My ultimate goal is to have most of my database operations run as stored procedures using interdev to create the forms that will pass parameters and execute the stored procedures.

Next installment... Uncle Roydee looks for help with drop down listboxes.
 
Roydee,

Under your 'Project Explorer' find your 'global.asa' file. Right click and choose 'Add Data Connection' from the context menu.

Create the connection by following the wizard steps.

Now drop a DTC Recordset control on an empty .ASP page.
Set the Connection property to point to your connection.
Set up the remaining Recordset properties.

Now drop a DTC Text box on the page and right click on it. Choose the 'Properties' command on the context menu.

Set the 'Data.Recordset' property to the Recordset control you just created.
Set the 'Field' property.

Now run the page B-)

Hope this helps
-pete
 
Thanks Pete.

I've been doing pretty much what you prescribed and keep getting errors. The latest was:

"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/DB_Connectivity_test/connectivitytest1.asp, line 30"

line 30 reads " if (thisPage.getState('pb_Recordset1') != null)"

Interdev makes the connection, if I open the command in VI the table displays but when I try to open the ASP it breaks.

I've tried a number of connections and differing logins, Administrator and Anonymous (IUSR_***)

Thanks again.
 
RoyDee,

> Interdev makes the connection, if I open the command in VI the table
> displays but when I try to open the ASP it breaks.

Keep in mind that when you access the database from VI you are using 'your' credentials to connect. Not the same coming through the Web Server as you pointed out (IUSR_***).

> [Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified

You sure need a connection, In an earlier post I mentioned using the 'Connection String' property in the 'Connection Properties' dialog rather than a DSN. I don't believe you ever responded to that. When the wizard builds a connection and tests it the next screen should have a 'Connection String' in the dialog. Have you tried using the provided connection string settings?

I understand your frustration, but this is certainly something we should be able to resolve.

-pete

 
Pete,

Thanks. I've been able to view pages connected to my database using the NetBios name and machine DSN, but when I configure the data connection to use the IP address then viewing in the browser fails due to login failure.

I'm thankful to be able to use the Netbios name for now. I can continue to develop the project and work on the authentication as I go along.

BTW, ultimately this web site will not permit anonymous access but will require SQL Authentication to accomodate Netscape clients. So I will soon need to master all aspects of authentication as they pertain to VI.

Thanks,
 
Roy,

Here is an example connection string that the wizard builds for you when connecting to a SQL Server. Notice that the 'Data Source' value is a 'Network Name' not an IP address. These connection strings will work as long as the 'User' account you use has permission to the database and tables etc that you reference in your SQL statments

Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=RNV-PALBANO;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top