473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DB connection in asb


Hello
I do not know anything about asb but I just want to import this part of VBscript file to an asp code to help my frined. This part of code is working if I run it as a vbscript on the command line, but we could not get it run in a asb files.

MyODBC = "SQLODBC
MyUsername = "sa
MyPassword = "password

Set objADODBConn = CreateObject("ADODB.Connection"
strConn="DSN=" & MyODBC & ";UID=" & MyUsername & ";PWD=" & MyPassword & ";
objADODBConn.Open(strConn

Any suggestion? Is there anything we miss? Can anyone give us an example to make a ODBC connection in an asb file
Thanks
cT

Jul 19 '05 #1
13 2705
Connection Strings http://www.darkfalz.com/1059

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"JIM.H." <an*******@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...

Hello,
I do not know anything about asb but I just want to import this part of VBscript file to an asp code to help my frined. This part of code is working
if I run it as a vbscript on the command line, but we could not get it run
in a asb files.
MyODBC = "SQLODBC"
MyUsername = "sa"
MyPassword = "password"

Set objADODBConn = CreateObject("ADODB.Connection")
strConn="DSN=" & MyODBC & ";UID=" & MyUsername & ";PWD=" & MyPassword & ";" objADODBConn.Open(strConn)

Any suggestion? Is there anything we miss? Can anyone give us an example to make a ODBC connection in an asb file? Thanks,
cT.

Jul 19 '05 #2
Are you getting an error of some sort? And dumb question, but are you
saving your files with a .asP extension?

Ray at work

"JIM.H." <an*******@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...

Hello,
I do not know anything about asb but I just want to import this part of VBscript file to an asp code to help my frined. This part of code is working
if I run it as a vbscript on the command line, but we could not get it run
in a asb files.
MyODBC = "SQLODBC"
MyUsername = "sa"
MyPassword = "password"

Set objADODBConn = CreateObject("ADODB.Connection")
strConn="DSN=" & MyODBC & ";UID=" & MyUsername & ";PWD=" & MyPassword & ";" objADODBConn.Open(strConn)

Any suggestion? Is there anything we miss? Can anyone give us an example to make a ODBC connection in an asb file? Thanks,
cT.

Jul 19 '05 #3
Hello
Yes, there is a asp file and we are trying to embed this script there, we do not know where to start. We put it between <% %> in an asp file, but it does not work and give connection error, even if the script works on the command line
Thanks
Jim
Jul 19 '05 #4
What error?

Ray at work

"JIM.H." <an*******@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hello,
Yes, there is a asp file and we are trying to embed this script there, we do not know where to start. We put it between <% %> in an asp file, but it
does not work and give connection error, even if the script works on the
command line. Thanks,
Jim

Jul 19 '05 #5
Hello
Thanks for the reply
How can I use that test.udl in a asp file
Thanks
Jim

Jul 19 '05 #6
"Ray at <%=sLocation%>" wrote:
: Are you getting an error of some sort? And dumb question, but are you
: saving your files with a .asP extension?

Ray...

I'm surprised you're not familiar with ASB (Active Server Books). It allows
you to run a lot of ASP (Active Server Pages) at one time. (O:=
--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default...&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/tre...er/default.asp
-WSH 5.6 documentation download-
http://www.microsoft.com/downloads/d...displaylang=en
-MSDN Library-
http://msdn.microsoft.com/library/default.asp
Jul 19 '05 #7
JIM.H. wrote:
Hello,
Thanks for the reply.
How can I use that test.udl in a asp file?
Thanks,
Jim.


You usually wouldn't. You would open the udl file in a text editor, such as
Notepad, and copy and paste the connection string into your asp page (or an
include file). Like this:

dim cn, sConnect
sConnect="<text copied from udl file>"
set cn=server.createobject("adodb.connection")
cn.Open sConnect
However, if you want to distribute the udl file with your application, you
can use the file itself in the open statement:

cn.open "filename.udl"

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #8
That was good. :]

Ray at work

"Roland Hall" <nobody@nowhere> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...

I'm surprised you're not familiar with ASB (Active Server Books). It allows you to run a lot of ASP (Active Server Pages) at one time. (O:=

Jul 19 '05 #9
On Tue, 20 Jan 2004 12:26:10 -0800, JIM.H. <an*******@discussions.microsoft.com> wrote:
Hello,
Thanks for the reply.
How can I use that test.udl in a asp file?
Thanks,
Jim.


You don't..You use the text it created ( edit it with notepad) to build your connection string in the asp page.
Here is a for instance
<%
' Create and establish data connection
Set objDC = Server.CreateObject("ADODB.Connection")
objDC.ConnectionTimeout = 15
objDC.CommandTimeout = 30

'Code to connect--------------<This is from the UDL file>
objDC.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Test;Data Source=MySqlServer"
%>:

Jul 19 '05 #10
Im going to remember that one, very funny.
Don

"Roland Hall" <nobody@nowhere> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
"Ray at <%=sLocation%>" wrote:
: Are you getting an error of some sort? And dumb question, but are you
: saving your files with a .asP extension?

Ray...

I'm surprised you're not familiar with ASB (Active Server Books). It allows you to run a lot of ASP (Active Server Pages) at one time. (O:=
--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default...&ln=EN-US&FR=0 -Technet Script Center-
http://www.microsoft.com/technet/tre...er/default.asp -WSH 5.6 documentation download-
http://www.microsoft.com/downloads/d...displaylang=en -MSDN Library-
http://msdn.microsoft.com/library/default.asp

Jul 19 '05 #11
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not exist or access denied.
Jul 19 '05 #12
Does this server exist? OECCSQLWEB? Is the server that you're executing
this on able to resolve that name to the IP address of the server? Try
switching it to the IP address of the SQL server. If that works, either
continue using the IP address or solve your name resolution problems on your
web server.

Ray at work

"JIM.H." <an*******@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
Hello,

This is the code I created through udl and I get the following error.

Code:
Dim objDBConnect

Set objDBConnect = Server.CreateObject("ADODB.Connection")
objDBConnect.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=OECCSQLWEB"
Error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not exist or access denied. Thanks,
Jim.

Jul 19 '05 #13
JIM.H. wrote:
Hello,

This is the code I created through udl and I get the following error.

Code:
Dim objDBConnect

Set objDBConnect = Server.CreateObject("ADODB.Connection")
objDBConnect.Open "Provider=MSDASQL.1;Persist Security
Info=False;User ID=sa;Data Source=OECCSQLWEB"

Error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not
exist or access denied.
Thanks,
Jim.


You chose the ODBC provider instead of the SQL Server provider when creating
your udl file. And then you selected a DSN form the list. Does this DSN
exist on the web server?

I suggest using OLEDB instead of the obsolet ODBC. Your connection string
should be:

objDBConnect.Open "Provider=SQLOLEDB.1;" & _
"Persist Security Info=False;" & _
"User ID=<some user other than sa>; " & _
"Password=<that user's password>;" & _
"Data Source=<the name of the server itself>"

See www.able-consulting.com/ado_conn.htm for more examples of connection
strings

Don't use the sa account for applications. SA is god in your server! I
don't think you realize the havoc that can be caused by a hacker who manages
to log into your sql server under the sa account. Guard that account as if
your job depended on it - it probably does! Create a new sql login with only
the rights needed to do whatever needs to be done in the database. (You may
need to reconfigure SQL Server to use Mixed Authentication - see Books
Online)

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: G-Fit | last post by:
Hello group, I have several servers hosting SQL databases. On each of them, I have several databases. All those databases have the same structure (even those on different servers), only the data...
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
6
by: Chris Szabo | last post by:
I've created a data access layer for a .NET web application. I'm using C# and framework 1.1. I'm getting an error from time to time when I close a connection saying: ...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
0
by: Robert Avery | last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and displayed for the user all connection events, so that I could easily see what SQL was taking a long time, and when it freezes, I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.