Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help me get my feet wet 1

Status
Not open for further replies.

mtorbin

Technical User
Nov 5, 2002
369
0
0
US
Hey all,

OK, I'm starting on my first application after the class I took. I think I'm having some DB trouble and I don't know enough to fix it. Here is the code:

<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("h:\\Microsoft SQL Server\MSSQL\data\catalogRequest_Data.MDF")
%>
<html>
<head>
<title>Welcome To The Manufacturer Catalog Request System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="mcrs_style.css" rel="stylesheet" type="text/css">
<!--<script src="mcrsLib.js"></script>-->
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="223" height="118"><img src="images/siteLogo_index.jpg" width="223" height="118"></td>
<td bgcolor="#006666">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="223" height="21"><img src="images/siteLogo_bottom.jpg" width="223" height="21"></td>
<td bgcolor="#CCCC99">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="15">
<tr>
<td valign="top"><h3>Please Select A Manufacturer:</h3>
<br>
<form name="catForm" method="post" action="">
<table width="50%" border="0" cellspacing="0" cellpadding="5">
<tr valign="top" bgcolor="#CCCC99">
<td colspan="2"><strong>Sample Form </strong></td>
</tr>
<tr valign="top">
<td width="20%" align="right">Manufacturers:</td>
<td width="80%">
<select name="mfgDropDown">
<option value="#" selected>PLEASE SELECT A MANUFACTURER</option>

<%
Set rs = cn.Execute("SELECT * FROM tManufacturers)

While NOT rs.EOF
Response.Write "<option value=" & rs("mfgID") & "value>" & rs("mfgName") & "label</option>"
rs.MoveNext
Wend

Set rs = Nothing
%>
</select>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" bgcolor="#000000"><img src="images/spacer_000000.gif" width="1" height="2"></td>
</tr>
<tr>
<td align="center" valign="top" class="legalText">Copyright &copy; 2005 PEI-Genesis. All rights reserved.<br>
If you have any problems using this application, please contact the Webmaster.<br>
For questions or comments, please contact Rita Delvecchio.
</td>
</tr>
</table>
</body>
</html>

Could someone point me in the right direction?

Much appreciated!

- MT
 
Do you see an error message when this page is run?
 
first things first...change this line:

Response.Write "<option value=" & rs("mfgID") & "value>" & rs("mfgName") & "label</option>"

to

Response.Write "<option value=" & rs("mfgID") & ">" & rs("mfgName") & "</option>"

then let us know what errors are you getting...

-DNG
 
OK, here is the updated code:

<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../Microsoft SQL Server\MSSQL\data\catalogRequest_Data.MDF")
%>
<html>
<head>
<title>Welcome To The Manufacturer Catalog Request System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="mcrs_style.css" rel="stylesheet" type="text/css">
<!--<script src="mcrsLib.js"></script>-->
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="223" height="118"><img src="images/siteLogo_index.jpg" width="223" height="118"></td>
<td bgcolor="#006666">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="223" height="21"><img src="images/siteLogo_bottom.jpg" width="223" height="21"></td>
<td bgcolor="#CCCC99">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="15">
<tr>
<td valign="top"><h3>Please Select A Manufacturer:</h3>
<br>
<form name="catForm" method="post" action="">
<table width="50%" border="0" cellspacing="0" cellpadding="5">
<tr valign="top" bgcolor="#CCCC99">
<td colspan="2"><strong>Sample Form </strong></td>
</tr>
<tr valign="top">
<td width="20%" align="right">Manufacturers:</td>
<td width="80%">
<select name="mfgDropDown">
<option value="#" selected>PLEASE SELECT A MANUFACTURER</option>

<%
Set rs = cn.Execute("SELECT * FROM tManufacturers")

While NOT rs.EOF
Response.Write "<option value=" & rs("mfgID") & ">" & rs("mfgName") & "</option>"
rs.MoveNext
Wend

Set rs = Nothing
%>
</select>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="2" bgcolor="#000000"><img src="images/spacer_000000.gif" width="1" height="2"></td>
</tr>
<tr>
<td align="center" valign="top" class="legalText">Copyright &copy; 2005 PEI-Genesis. All rights reserved.<br>
If you have any problems using this application, please contact the Webmaster.<br>
For questions or comments, please contact Rita Delvecchio.
</td>
</tr>
</table>
</body>
</html>

And here is the updated error message:

Error Type:
Microsoft JET Database Engine (0x80004005)
The Microsoft Jet database engine cannot open the file 'H:\Microsoft SQL Server\MSSQL\data\catalogRequest_Data.MDF'. It is already opened exclusively by another user, or you need permission to view its data.
/CATREQ/index.asp, line 3

Does that MDF file have to be an MDB? If not, what do I change and where?

Thanks,

- MT
 
OK then. So this is something I have to export from SQL Enterprise Manager?

- MT
 
What database are you using? SQL Server or Access?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
change your connection string to:

Code:
set cn = server.createobject("ADODB.Connection")
cn.open "PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename"
 
So what do I replace "sqlservername" with?

- MT
 
Currently I'm developing it in SQL Server because that's what I have to work with.

- MT
 
YES, it worked! Here is the final results for those of you who are wondering:

Code:
<%
Set cn = Server.CreateObject("ADODB.Connection")
    'cn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../Microsoft SQL Server\MSSQL\data\catalogRequest_Data.MDF")
     cn.Open "PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=******;PWD=******;DATABASE=catalogRequest"
%>
<html>
<head>
<title>Welcome To The Manufacturer Catalog Request System</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="mcrs_style.css" rel="stylesheet" type="text/css">
<!--<script src="mcrsLib.js"></script>-->
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr valign="top">
 <td width="223" height="118"><img src="images/siteLogo_index.jpg" width="223" height="118"></td>
 <td bgcolor="#006666">&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr valign="top">
  <td width="223" height="21"><img src="images/siteLogo_bottom.jpg" width="223" height="21"></td>
  <td bgcolor="#CCCC99">&nbsp;</td>
 </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="15">
 <tr>
 <td valign="top"><h3>Please Select A Manufacturer:</h3>
  <br>        
  <form name="catForm" method="post" action="">
   <table width="50%"  border="0" cellspacing="0" cellpadding="5">
    <tr valign="top" bgcolor="#CCCC99">
     <td colspan="2"><strong>Sample Form </strong></td>
    </tr>
    <tr valign="top">
     <td width="20%" align="right">Manufacturers:</td>
     <td width="80%">
      <select name="mfgDropDown">
       <option value="#" selected>PLEASE SELECT A MANUFACTURER</option>		
       
       <%
           Set rs = cn.Execute("SELECT * FROM tManufacturers")
	   
           While NOT rs.EOF
	       Response.Write "<option value=" & rs("mfgID") & ">" & rs("mfgName") & "</option>"
	       rs.MoveNext
	   Wend
	   
           Set rs = Nothing
       %>
       </select>
      </td>
     </tr>
    </table>
   </form>
  </td>
 </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td height="2" bgcolor="#000000"><img src="images/spacer_000000.gif" width="1" height="2"></td>
 </tr>
 <tr>
  <td align="center" valign="top" class="legalText">Copyright &copy; 2005 PEI-Genesis. All rights reserved.<br>
   If you have any problems using this application, please contact the Webmaster.<br>
   For questions or comments, please contact Rita Delvecchio.
  </td>
 </tr>
</table>
</body>
</html>
 
DNG, thanks for that link! I'm sure that I (and others here in TT) will find that useful...

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top