![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Logon to a SQL Server
Hi, All,
I have two basic ASP pages and I'm trying to connect to a SQL Server 2005 Database which is on a different computer (Server-001). The first file is called TestTwo.asp and is in the root/folder: Connections It connect is below: <% ' FileName="Connection_odbc_conn_dsn.htm" ' Type="ADO" ' DesigntimeType="ADO" ' HTTP="false" ' Catalog="" ' Schema="" Dim MM_TestTwo_STRING MM_TestTwo_STRING = "dsn=Hagis SQL Server;uid=czwanenburg;pwd=silverbird262;" %> A very basic webpages called LoginOne.asp has the following code: <%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/TestTwo.asp" --> <% Dim Recordset1 Dim Recordset1_numRows Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = MM_TestTwo_STRING Recordset1.Source = "SELECT * FROM dbo.BullionProductName" Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() Recordset1_numRows = 0 %> <style type="text/css"> <!-- body { background-color: #FFFFE6; } .style1 { font-size: 14px; font-family: Geneva, Arial, Helvetica, sans-serif; } --> </style> <title>Hagis Net</title> <% Recordset1.Close() Set Recordset1 = Nothing %> Anytime I put something within the statement between: <% %> my page shows not the webpage in the browser but directly the code itself. It seems that not only the login script when I put it between these: <% %>, but also the rest doesn't work out well. I think that the TestTwo.asp page is OK, because when I run a test within Dreamweaver MX 2004 the Recordset gives the SQL record and its content. So testing within Dreamweaver has a link/connection with my server and has the right authority, hence the correct UID and PWD. May anyone could make sense of it. <% ' FileName="Connection_odbc_conn_dsn.htm" ' Type="ADO" ' DesigntimeType="ADO" ' HTTP="false" ' Catalog="" ' Schema="" Dim MM_TestTwo_STRING MM_TestTwo_STRING = "dsn=Hagis SQL Server;uid=czwanenburg;pwd=silverbird262;" %> <% Dim Recordset1 Dim Recordset1_numRows Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = MM_TestTwo_STRING Recordset1.Source = "SELECT * FROM dbo.BullionProductName" Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() Recordset1_numRows = 0 %> <style type="text/css"> <!-- body { background-color: #FFFFE6; } .style1 { font-size: 14px; font-family: Geneva, Arial, Helvetica, sans-serif; } --> </style> <title>Hagis Net</title> <% Recordset1.Close() Set Recordset1 = Nothing %> |
|
|||
|
Re: Logon to a SQL Server
Hi there,
to all your questions I can see Yes. Currently I'm running a full intranet with 100+ webpages and ASP pages on a remote server in a local network. The webpage connect to a seperate disk with an ACCESS Database. All this works, so connections, script and routing seems OK. I'm switching from MS Access to MS SQL server 2005. Dreamweaver properly makes the connection, but the pages that I copied from my website that had a correct connection with de Access Dbase now doens't connect to MS SQL, although Dreamweaver seems to have made the right connection. Hope this helps. Looking forward to hear from you, Carl. |
|
|||
|
Re: Logon to a SQL Server
"Gold-bug" <webforumsuser@macromedia.com> wrote in message news:g7aafo$c2t$1@forums.macromedia.com... > Hi, All, > > I have two basic ASP pages and I'm trying to connect to a SQL Server 2005 > Database which is on a different computer (Server-001). > The first file is called TestTwo.asp and is in the root/folder: > Connections > > It connect is below: > > <% > ' FileName="Connection_odbc_conn_dsn.htm" > ' Type="ADO" > ' DesigntimeType="ADO" > ' HTTP="false" > ' Catalog="" > ' Schema="" > Dim MM_TestTwo_STRING I do hope you quickly go back to that server and change your password if not both the username and password as you just broadcast the login info to the world :( |
|
|||
|
Re: Logon to a SQL Server
>to all your questions I can see Yes.
Well I am confused. On one hand you say that the browser is displaying the ASP code which tells me it's not being parsed by the ASP engine. Is that still happening? Regarding the connection problem, did you create the ODBC DSN on the server? Have you tried using a DSN-less connection? |
|
|||
|
Re: Logon to a SQL Server
Hi Bregent,
The moment I put script between the <% %>, the webpages displays in the frame just code. If I only have style information I got a nice blank page. Even some code that creates buttons, etc. is no problem. i.e. HTML code is fine, but code to access the Database is a no go. I think it has to do with the fact that the webpage tries to access the SQL dbase and bounces. That fact alone creates a malfunction why the frame as part of the webpages doesn't respond properly and presents just the code. I also think that the SQL server first needs to accept the webpages bases on an approved/accepted UID and PSW. So what I'm looking for is the correct script which will open a link to the SQL Dbase. I think something like the following code should do the trick, but for now, no luck. Hope jou have some thoughts. Kind Regards, Carl. Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase ;Uid=myUsername;Pwd=myPassword ; |
|
|||
|
Re: Logon to a SQL Server
>I think it has to do with the fact that the webpage tries to access the SQL
dbase and bounces. >That fact alone creates a malfunction why the frame as part of the webpages doesn't respond >properly and presents just the code. I doubt it. If that was the fact it would indicate a seriously misconfigured IIS/ASP server. Exposing your server side code as a result of a database error would be a huge security risk. Does other non-database related ASP code execute properly? Is this occurring on a local testing server, or on a remote server or both? |
|
|||
|
Re: Logon to a SQL Server
Other non-database relate items works fine.
I'm using one workstation in a direct link with a server station. On both stations XP is running. On the Server station I have a disk D: within a subdirectory all my intranet pages. On disk E: I have the SQL running. From the Workstation I normally open a page (Server/D:/x.asp) and that works fine. Now the webpage needs to get access to the SQL Dbase (Server/E:/SQLDbase). That's basicly how the network is setup. I'm think of having a separate station for the webpages and a separate for just SQL. Hopefully that makes life easyer. But it should work. P.S. on disk F: an MS Access Dbase is running now and that works fine, no problems at all, but Access is open as hell. SQL needs approvall first i quest! Hope this helps. Thanks, Carl. |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|