jkleist
asked on
OCDB CONNECTION
I HAVE THE COONECTION TO MY DATABASE SET UP TO LOOK ON LOCAL DISC C:, BUT WHEN I TRY TO PROCESS THE ASP PAGE THE ERROR MESSAGE SAYS THAT THE PATH TO ANOTHER SERVER IN NOT VALID. I DO NOT HAVE IT SET UP TO LOOK AT THAT SERVER.
CAN SOMEONE EXPLAIN THIS, IS THE COMPUTER LOST?
I AM USING DREAMWEAVER MX, AN ASSESS DATABASE, AND AN OCDB SET UP FOR DRICE C:
CAN SOMEONE EXPLAIN THIS, IS THE COMPUTER LOST?
I AM USING DREAMWEAVER MX, AN ASSESS DATABASE, AND AN OCDB SET UP FOR DRICE C:
Make sure that the ODBC Driver that you are selecting is correct. At times there are multiple ODBC drivers for access databases. For example, there may be a "Microsoft Access Treiber" and aso a "Microsoft Access Driver". Make sure you select the Microsoft Access "Driver" ODBC connection.
Also, check whether the ODBC connection that you are making is under the System DSN tab.
Also, check whether the ODBC connection that you are making is under the System DSN tab.
Are you using Server.MapPath("C:\yourdat abase.mdb" ) in your connection string?
If your database resides under your the root C:\ then this is a physical path and the Server.MapPath() uses virtual paths (under inetpub/wwwroot) the virtual path is based on the directory your currently in. Please post your code.
--------
D_M_D
If your database resides under your the root C:\ then this is a physical path and the Server.MapPath() uses virtual paths (under inetpub/wwwroot) the virtual path is based on the directory your currently in. Please post your code.
--------
D_M_D
Try this procedure on your WebServer (where your ASP-pages are stored).
Create in any folder on your webserver a new file with extension UDL, for example create 'test.udl' in your temp-folder.
Once created, double click on it ... The dialogbox 'Data Link Properties' is started.
Now, with this nice tool, make your connection to your SQL-Server, Access-DB or any other DB. Once configured and TESTED with the Test-Connection button, close this window.
Last step: Open this test.udl file in any Text-editor, for example NotePad. The last line in this file, starting with 'Provider ...' is your connectionstring. So copy/paste it in your ASP-file. Because we tested it in the 'Data Link Properties', it will work!
One remark. When building a connection-string (for ex. for SQL-Server) with a user that has a password, please activate the option 'Allow saving Password'. But when using an Access database, you don't need it ...
An additional link:
Guide to Database Connection Strings:
http://www.razza.com/support/kbarticle.asp?ID=2
One remark on this page, when programming ASP (VB-Script) and using MS Access, SQL-Server, I would always use the OLEDB-way to connect, because there are some disadvantages with ODBC.
Create in any folder on your webserver a new file with extension UDL, for example create 'test.udl' in your temp-folder.
Once created, double click on it ... The dialogbox 'Data Link Properties' is started.
Now, with this nice tool, make your connection to your SQL-Server, Access-DB or any other DB. Once configured and TESTED with the Test-Connection button, close this window.
Last step: Open this test.udl file in any Text-editor, for example NotePad. The last line in this file, starting with 'Provider ...' is your connectionstring. So copy/paste it in your ASP-file. Because we tested it in the 'Data Link Properties', it will work!
One remark. When building a connection-string (for ex. for SQL-Server) with a user that has a password, please activate the option 'Allow saving Password'. But when using an Access database, you don't need it ...
An additional link:
Guide to Database Connection Strings:
http://www.razza.com/support/kbarticle.asp?ID=2
One remark on this page, when programming ASP (VB-Script) and using MS Access, SQL-Server, I would always use the OLEDB-way to connect, because there are some disadvantages with ODBC.
Can you paste your code here
CJ
CJ
ASKER
SELECT left([data1],3), mid([data1],4,15), mid([data1],19,30), mid([data1],49,9), mid([data1],58,2), mid([data1],60,6)
FROM webdata
WHERE left([DATA1],3) LIKE 'ACC' AND mid([data1],4,15) LIKE '%MMM%'
ORDER BY left([data1],3) ASC, mid([DATA1],4,15) ASC
THIS IS THE QUERY ON THE DATABASE....
ACC AND MMM ARE VAIABLES THAT DEFINE FIELDS ON
THE INPUT ASP PAGE.
FROM webdata
WHERE left([DATA1],3) LIKE 'ACC' AND mid([data1],4,15) LIKE '%MMM%'
ORDER BY left([data1],3) ASC, mid([DATA1],4,15) ASC
THIS IS THE QUERY ON THE DATABASE....
ACC AND MMM ARE VAIABLES THAT DEFINE FIELDS ON
THE INPUT ASP PAGE.
jkleist,
This is your SQL-Statement ... We need your Connection-String, something like
Provider=Microsoft.Jet.OLE DB.4.0;Dat a Source=C:\Folder1\dbname.m db;Persist Security Info=False
This is your SQL-Statement ... We need your Connection-String, something like
Provider=Microsoft.Jet.OLE
Please post all of your code the whole page...
Thanks
--------
D_M_D
Thanks
--------
D_M_D
ASKER
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/net.asp" -->
<!--#include file="Connections/stockche ck.asp" -->
<%
var stock_check__ACC = "%";
if (String(Request.Form("manu facturer") ) != "undefined" &&
String(Request.Form("manuf acturer")) != "") {
stock_check__ACC = String(Request.Form("manuf acturer")) ;
}
%>
<%
var stock_check__MMM = "%";
if (String(Request.Form("item number")) != "undefined" &&
String(Request.Form("itemn umber")) != "") {
stock_check__MMM = String(Request.Form("itemn umber"));
}
%>
<%
var stock_check = Server.CreateObject("ADODB .Recordset ");
stock_check.ActiveConnecti on = MM_net_STRING;
stock_check.Source = "SELECT left([data1],3), mid([data1],4,15), mid([data1],19,30), mid([data1],49,9), mid([data1],58,2), mid([data1],60,6) FROM webdata WHERE left([DATA1],3) LIKE '"+ stock_check__ACC.replace(/ '/g, "''") + "' AND mid([data1],4,15) LIKE '%"+ stock_check__MMM.replace(/ '/g, "''") + "%' ORDER BY left([data1],3) ASC, mid([DATA1],4,15) ASC";
stock_check.CursorType = 0;
stock_check.CursorLocation = 2;
stock_check.LockType = 1;
stock_check.Open();
var stock_check_numRows = 0;
%>
<%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
stock_check_numRows += Repeat1__numRows;
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
DoCurrency = FormatCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
End Function
</SCRIPT>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoTrim(str, side)
dim strRet
strRet = str
If (side = 0) Then
strRet = LTrim(str)
ElseIf (side = 1) Then
strRet = RTrim(str)
Else
strRet = Trim(str)
End If
DoTrim = strRet
End Function
</SCRIPT>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><font size="+1" face="Arial, Helvetica, sans-serif"></font></p>
<p align="center"> </p>
<p align="center"><strong><fo nt size="+2" face="Arial, Helvetica, sans-serif">
</font></strong></p>
<p align="center"> </p>
<p align="left"><font size="+2" face="Arial, Helvetica, sans-serif"><strong>Stock
Check Results</strong></font> </p>
<div align="left">
<table border="1">
<tr>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">Mfg.</font></s trong></di v></td>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">Item
#</font></strong></div></t d>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">Description</f ont></stro ng></div>< /td>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">Mfg.
Retail</font></strong></di v></td>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">uom</font></st rong></div ></td>
<td><div align="center"><strong><fo nt face="Arial, Helvetica, sans-serif">O/H
Qty.</font></strong></div> </td>
</tr>
<% while ((Repeat1__numRows-- != 0) && (!stock_check.EOF)) { %>
<tr>
<td><div align="center"><font size="-1" face="Arial, Helvetica, sans-serif"><%= (stock_check.Fields.Item(" Expr1000") .Value).to UpperCase( ) %></font></div></td>
<td><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><%= DoTrim((stock_check.Fields .Item("Exp r1001").Va lue),1) %></font></div></td>
<td><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><%=(stock_chec k.Fields.I tem("Expr1 002").Valu e)%></font ></div></t d>
<td><div align="right"><font size="-1" face="Arial, Helvetica, sans-serif"><%= DoCurrency((stock_check.Fi elds.Item( "Expr1003" ).Value), -1, -2, -2, -2) %></font></div></td>
<td><div align="center"><font size="-1" face="Arial, Helvetica, sans-serif"><%=(stock_chec k.Fields.I tem("Expr1 004").Valu e)%></font ></div></t d>
<td><div align="center"><font size="-1" color="BLUE" face="Arial, Helvetica, sans-serif"><strong><%=(st ock_check. Fields.Ite m("Expr100 5").Value) %></strong ></font></ div></td>
</tr>
<%
Repeat1__index++;
stock_check.MoveNext();
}
%>
</table>
</div>
<p>To Check Another Item </p>
<p><a href="STOCK_CHECK.asp">Cli ck Here</a></p>
</body>
</html>
<%
stock_check.Close();
%>
<!--#include file="Connections/net.asp"
<!--#include file="Connections/stockche
<%
var stock_check__ACC = "%";
if (String(Request.Form("manu
String(Request.Form("manuf
stock_check__ACC = String(Request.Form("manuf
}
%>
<%
var stock_check__MMM = "%";
if (String(Request.Form("item
String(Request.Form("itemn
stock_check__MMM = String(Request.Form("itemn
}
%>
<%
var stock_check = Server.CreateObject("ADODB
stock_check.ActiveConnecti
stock_check.Source = "SELECT left([data1],3), mid([data1],4,15), mid([data1],19,30), mid([data1],49,9), mid([data1],58,2), mid([data1],60,6) FROM webdata WHERE left([DATA1],3) LIKE '"+ stock_check__ACC.replace(/
stock_check.CursorType = 0;
stock_check.CursorLocation
stock_check.LockType = 1;
stock_check.Open();
var stock_check_numRows = 0;
%>
<%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
stock_check_numRows += Repeat1__numRows;
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
DoCurrency = FormatCurrency(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
End Function
</SCRIPT>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoTrim(str, side)
dim strRet
strRet = str
If (side = 0) Then
strRet = LTrim(str)
ElseIf (side = 1) Then
strRet = RTrim(str)
Else
strRet = Trim(str)
End If
DoTrim = strRet
End Function
</SCRIPT>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p><font size="+1" face="Arial, Helvetica, sans-serif"></font></p>
<p align="center"> </p>
<p align="center"><strong><fo
</font></strong></p>
<p align="center"> </p>
<p align="left"><font size="+2" face="Arial, Helvetica, sans-serif"><strong>Stock
Check Results</strong></font> </p>
<div align="left">
<table border="1">
<tr>
<td><div align="center"><strong><fo
<td><div align="center"><strong><fo
#</font></strong></div></t
<td><div align="center"><strong><fo
<td><div align="center"><strong><fo
Retail</font></strong></di
<td><div align="center"><strong><fo
<td><div align="center"><strong><fo
Qty.</font></strong></div>
</tr>
<% while ((Repeat1__numRows-- != 0) && (!stock_check.EOF)) { %>
<tr>
<td><div align="center"><font size="-1" face="Arial, Helvetica, sans-serif"><%= (stock_check.Fields.Item("
<td><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><%= DoTrim((stock_check.Fields
<td><div align="left"><font size="-1" face="Arial, Helvetica, sans-serif"><%=(stock_chec
<td><div align="right"><font size="-1" face="Arial, Helvetica, sans-serif"><%= DoCurrency((stock_check.Fi
<td><div align="center"><font size="-1" face="Arial, Helvetica, sans-serif"><%=(stock_chec
<td><div align="center"><font size="-1" color="BLUE" face="Arial, Helvetica, sans-serif"><strong><%=(st
</tr>
<%
Repeat1__index++;
stock_check.MoveNext();
}
%>
</table>
</div>
<p>To Check Another Item </p>
<p><a href="STOCK_CHECK.asp">Cli
</body>
</html>
<%
stock_check.Close();
%>
This is were you connectioinstring is set:
stock_check.ActiveConnecti on = MM_net_STRING;
But we need the value of this variable, so I guess we need also the code of these files:
- Connections/net.asp
- Connections/stockcheck.asp
But, check first this code for usernames and passwords ... and remove them or replace them with 'userid' and 'password'
stock_check.ActiveConnecti
But we need the value of this variable, so I guess we need also the code of these files:
- Connections/net.asp
- Connections/stockcheck.asp
But, check first this code for usernames and passwords ... and remove them or replace them with 'userid' and 'password'
ASKER
<%
// FileName="Connection_odbc_ conn_dsn.h tm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_stockcheck_STRING = "dsn=stockcheck;"
%>
<%
// FileName="Connection_odbc_ conn_dsn.h tm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_net_STRING = "dsn=net;"
%>
// FileName="Connection_odbc_
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_stockcheck_STRING = "dsn=stockcheck;"
%>
<%
// FileName="Connection_odbc_
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_net_STRING = "dsn=net;"
%>
do you have a system DSN created called net?
CJ
CJ
When using DreamWeaver MX, when creating a ConnectionString, you have this additional option:
DreamWeaver should connect:
- Using Driver On Testing Server
- Using Driver On This Machine
I don't know which option is selected, but it seems that you're using DSN's to connect your database. If the above option is set to Testing Server, check this Machine/Server if there is a DSN called 'stockcheck' and 'net' and also check them ...
If the option is set to This Machine (I suppose, because you write you set it up for drive C:) check your own DSN's ...
You can find your DSN-settings (if using W2K) here:
Control Panel -> Administrative Tools -> Data Sources (ODBC)
You must setup these datasources in the System DSN Tab ... Otherwise, they won't work when using in ASP-Pages ...
DreamWeaver should connect:
- Using Driver On Testing Server
- Using Driver On This Machine
I don't know which option is selected, but it seems that you're using DSN's to connect your database. If the above option is set to Testing Server, check this Machine/Server if there is a DSN called 'stockcheck' and 'net' and also check them ...
If the option is set to This Machine (I suppose, because you write you set it up for drive C:) check your own DSN's ...
You can find your DSN-settings (if using W2K) here:
Control Panel -> Administrative Tools -> Data Sources (ODBC)
You must setup these datasources in the System DSN Tab ... Otherwise, they won't work when using in ASP-Pages ...
ASKER
I do have stockcheck set up but not net. I do not have a databse called net nor do i have a connection named net
You set your ActiveConnection to the 'net' DSN, like this in your code:
stock_check.ActiveConnecti on = MM_net_STRING;
I think you need the StockCheck DSN-Connection, so change this line like this:
stock_check.ActiveConnecti on = MM_stockcheck_STRING ;
Try it ...
stock_check.ActiveConnecti
I think you need the StockCheck DSN-Connection, so change this line like this:
stock_check.ActiveConnecti
Try it ...
do you even need net connection.
Try removing that line and see if it works.
From your code it seems like you are just doing stockcheck db stuff not anything else.
CJ
Try removing that line and see if it works.
From your code it seems like you are just doing stockcheck db stuff not anything else.
CJ
ASKER
YES, IT IS JUST A SIMPLE STOCK CHECK. THE ISSUE WE HAVE IS THE .dbf FILE IS ON A LOCKED DATABASE SYSTEM. I CAN EXTRACT THE DATA INTO A dbf FILE "FLAT LAYOUT", BUT WHEN
WE PUT IT ON OUR TEST SERVER IT RUNS VERY SLOW, SEQUENTIALLY SEARCHING FILE AS A dbf CONNECTION. IF I LINK THE DATABASE TO AN ACCESS mdb FILE, THE ODBC CANNOT FIND THE FILE. IT'S LIKE WE GET ONE ISSUE FIXED THEN ANOTHER GOES HAYWIRE..... WE WANT TO HAVE THE DATA AS UP TO DATE AS POSSIBLE, I HAVE AN AUTO DUMP FROM THE LOCKED SYSTEM EVERY HOUR, THEN HAVE SCHEDULER OVERWRITE THE CURRENT .dbf FILE ON THE SERVER. PART OF IT HAS TO DO WITH I.E. PERMISSIONS I THINK....I DON'T KNOW, THIS SHOULD HAVE BEEN AN EASY PROJECT...
WE PUT IT ON OUR TEST SERVER IT RUNS VERY SLOW, SEQUENTIALLY SEARCHING FILE AS A dbf CONNECTION. IF I LINK THE DATABASE TO AN ACCESS mdb FILE, THE ODBC CANNOT FIND THE FILE. IT'S LIKE WE GET ONE ISSUE FIXED THEN ANOTHER GOES HAYWIRE..... WE WANT TO HAVE THE DATA AS UP TO DATE AS POSSIBLE, I HAVE AN AUTO DUMP FROM THE LOCKED SYSTEM EVERY HOUR, THEN HAVE SCHEDULER OVERWRITE THE CURRENT .dbf FILE ON THE SERVER. PART OF IT HAS TO DO WITH I.E. PERMISSIONS I THINK....I DON'T KNOW, THIS SHOULD HAVE BEEN AN EASY PROJECT...
Your write:
IF I LINK THE DATABASE TO AN ACCESS mdb FILE, THE ODBC CANNOT FIND THE FILE.
But, you must create/adapt your DSN to this NEW Access-Database (with a different-name). Or did you do that ... ?
IF I LINK THE DATABASE TO AN ACCESS mdb FILE, THE ODBC CANNOT FIND THE FILE.
But, you must create/adapt your DSN to this NEW Access-Database (with a different-name). Or did you do that ... ?
ASKER
YES I DID RENAME IT, THE I.E. ERROR SAYS SOMETHING LIKE THIS the Microsoft jet databse engine cannot find the input table or query \webdata#dbf
they are both in the same dirctory, and access is linked to it.
????
they are both in the same dirctory, and access is linked to it.
????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I'll try it tonight. First I'll dump what I've got out there to avoid errors, and start from scratch...I'll advise tomorrow.
sounds like the correct answer.
sounds like the correct answer.
yeah, its was a pain for me as it took me a while to figure it out as I got the basic- table not found error too :-)
Keep us posted.
CJ
Keep us posted.
CJ
Glad to help and Thnx for the "A"
CJ
CJ
And btw is it not against the rules to type in caps only :)