Subject: Help with DreamweaverMX and Stored Procedure input
Posted By: Chc325 Post Date: 10/7/2004 12:01:46 PM
I'm deep in a project and need help asap with Dreamweaver MX inability to handle input parameters in a Stored Procedure (MSSQL2000).
Here's the start of the SP:
CREATE PROCEDURE dbo.PageBookCheck(
     @Title varchar(75),
     @Comments varchar(75),
     @FiledDate datetime,
     @PageCount int,
     @MapType int,
     @CreateDate datetime)
 AS

When I run the ASP page with the command object behavior, I get the same error message on all paramaters except the two text ones OR it will run just fine for a few times then error out. It's a bug or poorly designed software I'm convinced. Macromedia says to fiddle with converting the data types. I've tried that. Surely you know a better way. How do I use the DMX command object with these input paramaters so the asp page will run? Help. Thanks in advance for a prompt response.

Reply By: Imar Reply Date: 10/7/2004 1:27:29 PM
Hi there,

Can you post the relevant ASP code?

Dreamweaver is not involved at run-time, so the problem must occur somewhere in the ASP code that Dreamweaver has created for you.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: Chc325 Reply Date: 10/7/2004 3:48:54 PM
 Hi Imar,
Here is the main asp code for the Stored Procedure and user input form. I thank you so much for helping. If you need more info, please don't hesitate to ask.
Regards,
Charlie

%>
<!--#include file="../Connections/MapCon.asp" -->
<%

set spMapType = Server.CreateObject("ADODB.Command")
spMapType.ActiveConnection = MM_MapCon_STRING
spMapType.CommandText = "dbo.MapType"
spMapType.CommandType = 4
spMapType.CommandTimeout = 0
spMapType.Prepared = true
spMapType.Parameters.Append spMapType.CreateParameter("@RETURN_VALUE", 3, 4)
set TT = spMapType.Execute
TT_numRows = 0

%>
<%

Dim spCheckBookPage__Title
spCheckBookPage__Title = ""
if(Request("Title") <> "") then spCheckBookPage__Title = Request("Title")

Dim spCheckBookPage__Comments
spCheckBookPage__Comments = ""
if(Request("Comments") <> "") then spCheckBookPage__Comments = Request("Comments")

Dim spCheckBookPage__FiledDate
spCheckBookPage__FiledDate = ""
if(Request("FiledDate") <> "") then spCheckBookPage__FiledDate = Request("FiledDate")

Dim spCheckBookPage__PageCount
spCheckBookPage__PageCount = ""
if(Request("PageCount") <> "") then spCheckBookPage__PageCount = Request("PageCount")

Dim spCheckBookPage__MapType
spCheckBookPage__MapType = ""
if(Request("MapType") <> "") then spCheckBookPage__MapType = Request("MapType")

Dim spCheckBookPage__CreateDate
spCheckBookPage__CreateDate = ""
if(Request("CreateDate") <> "") then spCheckBookPage__CreateDate = Request("CreateDate")

%>

<%

set spCheckBookPage = Server.CreateObject("ADODB.Command")
spCheckBookPage.ActiveConnection = MM_MapCon_STRING
spCheckBookPage.CommandText = "dbo.PageBookCheck"
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@RETURN_VALUE", 3, 4)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@Title", 200, 1,75,spCheckBookPage__Title)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@Comments", 200, 1,75,spCheckBookPage__Comments)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@FiledDate", 135, 1,8,spCheckBookPage__FiledDate)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@PageCount", 3, 1,4,spCheckBookPage__PageCount)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@MapType", 3, 1,4,spCheckBookPage__MapType)
spCheckBookPage.Parameters.Append spCheckBookPage.CreateParameter("@CreateDate", 135, 1,8,spCheckBookPage__CreateDate)
spCheckBookPage.CommandType = 4
spCheckBookPage.CommandTimeout = 0
spCheckBookPage.Prepared = true
spCheckBookPage.Execute()

%>

HERE IS THE FORM

<form name="AddMapForm" id="AddMapForm">
<table width="559" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#EAE9E1">
  <tr>
    <td height="24" colspan="4" bgcolor="#666666"><font color="#FFFFFF" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>1.
          Add Map Title </b></font></td>
  </tr>
  <tr>
    <td height="32" colspan="5" nowrap><font size="2" color="#000033">&nbsp;<b>Title/Name:</b></font>
        <input name="Title" type="text" id="Title" size="75" maxlength="75">
    </td>
  </tr>
  <tr>
    <td height="32" colspan="5" nowrap bgcolor="#FFFFFF"><font size="2" color="#000033">&nbsp;&nbsp;<b>Comments:</b></font>
        <input name="Comments" type="text" id="Comments" size="75" maxlength="75">
    </td>
  </tr>
  <tr>
    <td colspan="5" align="left" nowrap>&nbsp;&nbsp;&nbsp;&nbsp;<b><font color="#000033" size="2">File Date:</font></b>
        <input name="FiledDate" type="text" id="f_date_b" value="" size="10" maxlength="10">&nbsp;<img src="../Images/img.gif" width="20" height="14" align="absmiddle" id="f_trigger_b" style="cursor: pointer; border: 1px solid red;" title="Date selector"
      onMouseOver="this.style.background='red';" onMouseOut="this.style.background=''">&nbsp;&nbsp;&nbsp;&nbsp;
        
        <font color="#000033" size="2"><b>Map Type:</b></font>        &nbsp;
        <select name="MapType">
          <option value="">Select Type</option>
          <%
While (NOT TT.EOF)
%>
          <option value="<%=(TT.Fields.Item("TT").Value)%>"><%=(TT.Fields.Item("MT").Value)%></option>
          <%
  TT.MoveNext()
Wend
If (TT.CursorType > 0) Then
  TT.MoveFirst
Else
  TT.Requery
End If
%>
        </select>&nbsp;&nbsp;&nbsp;
        
            
        <font color="#000033" size="2"><b>Total Pages:
        <input name="PageCount" type="text" id="PageCount" size="2" maxlength="2">
        </b></font></td>
  </tr>
  <tr>
    <td width="113" nowrap bgcolor="#FFFFFF">&nbsp;</td>
    <td width="89" nowrap bgcolor="#FFFFFF">&nbsp;</td>
    <td width="136" nowrap bgcolor="#FFFFFF">&nbsp;</td>
    <td width="205" align="left" nowrap bgcolor="#FFFFFF">
      <input type="submit" name="Submit" value="Add Map Title">
&nbsp;&nbsp;
 <input type="reset" name="Reset" value="Reset">
<input type="hidden" name="CreateDate" value="<%=Now()%>">
  
  </tr>
</table>
</form>
<br>
</body>
</html>

Reply By: Imar Reply Date: 10/8/2004 1:49:51 PM
Does this page submit back to itself? If so, how come there is no protection to prevent the update from executing when the page loads first??

I can't find anything odd in your page. The Command object code looks fine; the numbers in the AddParameter method map to the appropriate parameter types in the sproc. So, the only thing I can think of is a mismatch of the data. You may be trying to pass empty values (when the page first loads) or incorrect formats, like an incorrect date format.

You mentioned an error in your previous post. What message do you get?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Go to topic 6471

Return to index page 750
Return to index page 749
Return to index page 748
Return to index page 747
Return to index page 746
Return to index page 745
Return to index page 744
Return to index page 743
Return to index page 742
Return to index page 741