RSS Forums RSS
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1837 | Replies: 4
Reply
Join Date: Jul 2004
Posts: 64
Reputation: koh is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

Question ASP to MsSQL

  #1  
Jul 30th, 2006
bottom here is my asp coding, for connecting to mssql2005
i know how to connect to mssql by vb using the com+.
but i want to try using the database connection on asp page.

 <%@ LANGUAGE="VBScript" %>
<%
Option Explicit
Dim UID, SQLStmt, Connection, FirstName, LastName
Dim RS, SSN, Major, GradDate
 SSN = Request.QueryString("SSN")
 Set Connection = Server.CreateObject("ADODB.Connection")
 Connection.Open "Driver = {SQL Server};Database=Db_Testing;UID=;PWD=;"
 SQLStmt = "SELECT * "
 SQLStmt = SQLStmt & "FROM detail "
 Set RS = Connection.Execute(SQLStmt)
%>
<h2><%= RS.Fields("name") %> <%= RS.Fields("telephone") %>:</h2>


i tried many ways, it seems that i am having problem connecting to database;
where i always receive the message below

Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

May i know whats wrong with my coding? or may be i missed a step for the connectivity.

Thank you
Last edited by koh : Jul 30th, 2006 at 9:44 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: ASP to MsSQL

  #2  
Jul 30th, 2006
You havn't told ADO where the server is, localhost/FQDN or IP address. try this:

Connection.Open "Data Source=localhost;Initial Catalog=Db_Testing;UID=;PWD=;"

This is a great reference for connection strings:

www.connectionstrings.com
Last edited by hollystyles : Jul 30th, 2006 at 5:43 pm.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Jul 2004
Posts: 64
Reputation: koh is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

Re: ASP to MsSQL

  #3  
Jul 31st, 2006
oic, but to the above coding
i placed them into vb6.0. It worked perfectly...

mind asking for another question...why?

thank you
Reply With Quote  
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,166
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Rep Power: 7
Solved Threads: 59
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: ASP to MsSQL

  #4  
Jul 31st, 2006
i placed them into vb6.0. It worked perfectly...

mind asking for another question...why?

You have to set the server somewhere, how can anything connect to DB_testing if it doesn't know where the server is? I can't answer your question because there are many ways to connect VB apps to a SQL Database through wizards and stuff and I wasn't looking over your shoulder when you did it so I can only make a stab in the dark...err maybe it was magic?
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote  
Join Date: Jul 2004
Posts: 64
Reputation: koh is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

Re: ASP to MsSQL

  #5  
Jul 31st, 2006
oic....i'd understand

thank you hollystyles
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 1:47 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC