Showing posts with label localhost. Show all posts
Showing posts with label localhost. Show all posts

Monday, 19 March 2012

Connect SQL database through ASP

I have SQL Server 2000 installed on my machine and tried
to develop asp script to connect to the server database
(localhost). But I got invalid authorization error
message, any help will be greatly appreciated. Following
is my script:
<%Option Explicit%>
<html>
<head>
<title>Testing Connection1</title>
</head>
<body>
<%
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data
Source=C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Master.mdf"
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnectionString
strSQL = "SELECT First_Name, Last_Name FROM
Member_Master"
objRS.Open strSQL, objConn
Set objFirstName = objRS("First_Name")
Set objLastName = objRS("Last_Name")
Do Until objRS.EOF
Response.Write objFirstName & " " & objLastName
& "<BR>"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
Thanks,
Sheridan
You have to set the DataSource in the connection string to the Server name,
not the operating system file name.
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data Source=(local)"
Should work, although it is better to replace (local) with the actual name
of the SQL Server (which should be the same as your computername if you have
a default installation).
Jacco Schalkwijk
SQL Server MVP
"Sheridan" <anonymous@.discussions.microsoft.com> wrote in message
news:25c0b01c46111$a9a8d950$a401280a@.phx.gbl...
> I have SQL Server 2000 installed on my machine and tried
> to develop asp script to connect to the server database
> (localhost). But I got invalid authorization error
> message, any help will be greatly appreciated. Following
> is my script:
> <%Option Explicit%>
> <html>
> <head>
> <title>Testing Connection1</title>
> </head>
> <body>
> <%
> Dim strConnectionString
> strConnectionString = "Provider=SQLOLEDB.1;Data
> Source=C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Master.mdf"
> Dim objConn, objRS
> Set objConn = Server.CreateObject("ADODB.Connection")
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnectionString
> strSQL = "SELECT First_Name, Last_Name FROM
> Member_Master"
> objRS.Open strSQL, objConn
> Set objFirstName = objRS("First_Name")
> Set objLastName = objRS("Last_Name")
> Do Until objRS.EOF
> Response.Write objFirstName & " " & objLastName
> & "<BR>"
> objRS.MoveNext
> Loop
> objRS.Close
> objConn.Close
> Set objRS = Nothing
> Set objConn = Nothing
> %>
> </body>
> </html>
> --
> Thanks,
> Sheridan

Connect SQL database through ASP

I have SQL Server 2000 installed on my machine and tried
to develop asp script to connect to the server database
(localhost). But I got invalid authorization error
message, any help will be greatly appreciated. Following
is my script:
<%Option Explicit%>
<html>
<head>
<title>Testing Connection1</title>
</head>
<body>
<%
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data
Source=C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Master.mdf"
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnectionString
strSQL = "SELECT First_Name, Last_Name FROM
Member_Master"
objRS.Open strSQL, objConn
Set objFirstName = objRS("First_Name")
Set objLastName = objRS("Last_Name")
Do Until objRS.EOF
Response.Write objFirstName & " " & objLastName
& "<BR>"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
--
Thanks,
SheridanYou have to set the DataSource in the connection string to the Server name,
not the operating system file name.
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data Source=(local)"
Should work, although it is better to replace (local) with the actual name
of the SQL Server (which should be the same as your computername if you have
a default installation).
Jacco Schalkwijk
SQL Server MVP
"Sheridan" <anonymous@.discussions.microsoft.com> wrote in message
news:25c0b01c46111$a9a8d950$a401280a@.phx
.gbl...
> I have SQL Server 2000 installed on my machine and tried
> to develop asp script to connect to the server database
> (localhost). But I got invalid authorization error
> message, any help will be greatly appreciated. Following
> is my script:
> <%Option Explicit%>
> <html>
> <head>
> <title>Testing Connection1</title>
> </head>
> <body>
> <%
> Dim strConnectionString
> strConnectionString = "Provider=SQLOLEDB.1;Data
> Source=C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Master.mdf"
> Dim objConn, objRS
> Set objConn = Server.CreateObject("ADODB.Connection")
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnectionString
> strSQL = "SELECT First_Name, Last_Name FROM
> Member_Master"
> objRS.Open strSQL, objConn
> Set objFirstName = objRS("First_Name")
> Set objLastName = objRS("Last_Name")
> Do Until objRS.EOF
> Response.Write objFirstName & " " & objLastName
> & "<BR>"
> objRS.MoveNext
> Loop
> objRS.Close
> objConn.Close
> Set objRS = Nothing
> Set objConn = Nothing
> %>
> </body>
> </html>
> --
> Thanks,
> Sheridan

Sunday, 11 March 2012

connect database with localhost

try
"(localhost)"

>--Original Message--
>Dear All,
>I have installed MSDE2000sp3 on a XP Professional with
the
>default instance name equal to the computer name (e.g
>COMP1). I have created a database in the local server. I
>want to connect the database by using "localhost" in the
>connection string(e.g. jdbc:inetdae7:localhost), but it
>was unsuccessful and the name "localhost" seems not to be
>recognized.
>For testing, I also try to setup a ODBC DSN
>with "localhost" as the server but also not success. I
can
>only use COMP1 to connect. Please tell me how can I
>connect through "localhost", many thanks..
>.
>
Nope. "(localhost)" is used for IIS. "(local)" or "." addresses the default
SS instance on the local system. This assumes that you installed MSDE as the
default instance and did not name the instance when it was installed.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"afkir" <anonymous@.discussions.microsoft.com> wrote in message
news:009301c4910e$535278e0$a401280a@.phx.gbl...[vbcol=seagreen]
> try
> "(localhost)"
> the
> can

Friday, 10 February 2012

Configure SQL XML support in IIS

I have configured SQL XML Support in IIS but still i am not able to Use

http://localhost/ss?Sql=select+*+from+users+for+xml+auto

I am getting Internal Server Error

Hi, if you're sure that the SQL XML Support in IIS has been configured correctly, you can try to add a root element for your output:

http://localhost/ss?sql=select+*+from+users+for+xml+auto&root=users

You can refer to this article for configuring virtual directory for SQLXML:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsql/ac_xml1_2xvd.asp

Configure Report Server with SQL Server Express with Advanced Services.

I am having trouble with SQL Express Reporting services.

When going to http:/localhost/reports I get the following error message:

"The report server is not responding. Verify that the report server is running and can be accessed from this computer."

In configuring the Report Server Virtual Directory, it would not let me set the name as "Report Server", so I named it "Report Server2".

I have tried uninstalling .NET framework v2 and reinstalling, but this does not help.

Any ideas?

By default, Express Advanced installs Report Server to a name instance, so you should be trying to get to http://localhost/reports$sqlexress. A default installation should have configured the virtual directory for you.

You can open SQL Server Configuration Manager and it will show you if the reporting service is running and if it has a name.

Mike