Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2004, 09:45 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to sql database w/ asp

Hi

I was wondering if someone can assist me in connecting to a sql data base. I getting this error when I try to connect.

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/forms/Test.asp, line 25


Here is the code:

Dim con, rs, str

set con=server.CreateObject("ADODB.CONNECTION")

con.Open "Provider=sqloledb;Data Source=Source_Forms;Initial Catalog=Source_Forms;User Id=Source_Web_User;Password=password;"

set rs=server.CreateObject("ADODB.RECORDSET")

rs.ActiveConnection=con

str="SELECT * Tickect_Number FROM Escalation_Form"

rs.open


objRS.Close

objConn.Close

Set objRs = Nothing

Set objConn =Nothing
%>




 
Old June 25th, 2004, 09:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Data Source=Source_Forms;Initial Catalog=Source_Forms

Looks like you are using same values for both. Can you check your SQL SERVER name and apply that in "Data source" parameter?

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 25th, 2004, 10:26 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I did Check and made the following changes:

con.Open "Provider=sqloledb;Data Source=MQIS;Initial Catalog=Source_Forms;User Id=Source_Web_User;Password=password;"

Then I got this Message:

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/forms/Test.asp, line 27

Which is pointing back to
where it says con.open

 
Old June 25th, 2004, 02:55 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was able to resolve that problem by using to correct field in the appropriate area:

con.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"

I have another question!

Does any one knows of a code that can generate a ticket number from the sql database into
the confirmation page? Using asp or generate a ticket number then have send to the database?

Thank you



 
Old June 27th, 2004, 11:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

It seems, you had used a wrong value in the previous occassion. Well, that is solved now.

Can you explain a bit more on what you refer as ticket number? Not sure what you are looking for.

Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old July 4th, 2004, 10:26 AM
Registered User
 
Join Date: Jul 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi there:

If I try that, I get the following runtime error when trying to start the app:

System.ArgumentException: Key word don't admitted: 'provider'.
   at System.Data.Common.DBConnectionString.ParseInterna l(Char[] connectionString, UdlSupport checkForUdl, NameValuePair& keychain)
   at System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl)
   at System.Data.SqlClient.SqlConnectionString..ctor(St ring connectionString)
   at System.Data.SqlClient.SqlConnectionString.ParseStr ing(String connectionString)
   at System.Data.SqlClient.SqlConnection.set_Connection String(String value)
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at Wrox.WebModules.Data.DbObject..ctor(String newConnectionString) in C:\Inetpub\wwwroot\plataforma\wrox\website\ThePhil eVB\WebModules\Core\DBObject.vb:line 32
   at Wrox.WebModules.Polls.Data.Questions..ctor(String newConnectionString) in C:\Inetpub\wwwroot\plataforma\wrox\website\ThePhil eVB\WebModules\Polls\Polls.Data\Questions.vb:line 33
   at Wrox.WebModules.Polls.Business.Question.GetCurrent Id() in C:\Inetpub\wwwroot\plataforma\wrox\website\ThePhil eVB\WebModules\Polls\Polls.Business\Question.vb:li ne 227
   at Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in C:\Inetpub\wwwroot\plataforma\wrox\website\ThePhil eVB\WebModules\Polls\Poll.ascx.vb:line 260
   at Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\plataforma\wrox\website\ThePhil eVB\WebModules\Polls\Poll.ascx.vb:line 62
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain()

why is this?
thx
 
Old July 4th, 2004, 12:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Looks like you have posted that in the wrong forum. I would suggest you to post that on a dotnet forum, for early replies.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 8th, 2004, 08:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

saeta57,

I've had problems with the Provider keyword in connection strings. In .NET, it doesn't seem to take them. To create a connection for your app, drag/drop a connection object onto a web or windows form, setup the connection, then highlight the connection and the connection string property will have the connection. You can then keep or delete the connection object; but that is a GUI trick to get the connection string.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to SQL database ashes0000 VB Databases Basics 11 April 20th, 2007 08:37 AM
Connecting to SQL database misskaos Classic ASP Databases 8 October 23rd, 2006 05:57 PM
Connecting to Sql server database with ASP.NET Abins ASP.NET 1.0 and 1.1 Basics 3 February 17th, 2006 06:56 PM
Connecting to SQL 2000 Database - New at this Tee88 Classic ASP Databases 14 October 2nd, 2004 04:23 AM
Connecting to SQL Database rwalker ASP.NET 1.x and 2.0 Application Design 3 December 17th, 2003 02:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.