doq1969 2019-05-15 07:42
浏览 208

尝试更新记录时SQL状态37000错误

I'm creating a form that allows a user to create a ticket and save it to a MS SQL table, they can also search tickets via a page which has a table displaying all records in that table. Next to each record is an 'edit' button which will allow the user to the update the record. When a user clicks edit and fills in the field I get the following error.

PHP Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'Test'., SQL state 37000 in SQLExecDirect in D:\inetpub\wwwroot\SMT_Request_Dev\board\Dashboard\insert.php on line 7" for lines 7, 8, & 9

jobUpdateNew.php

$(document).ready(function(){  
  $('#add').click(function(){  
       $('#insert').val("Insert");  
       $('#insert_form')[0].reset();  
  });  
  $(document).on('click', '.edit_data', function(){  
       var jobNumber = $(this).attr("id");  
       $.ajax({  
            url:"fetch.php",  
            method:"POST",  
            data:{jobNumber:jobNumber},  
            dataType:"json",  
            success:function(data){  
                 $('#Update_Description').val(data.Update_Description);  
                 $('#Updated_By').val(data.Updated_By);  
                 $('#Updated_Date').val(data.Updated_Date);    
                 $('#jobNumber').val(data.jobNumber);  
                 $('#insert').val("Update");  
                 $('#add_data_Modal').modal('show');  
            }  
       });  
  });  
  $('#insert_form').on("submit", function(event){  
       event.preventDefault();  
       if($('#Update_Description').val() == "")  
       {  
            alert("Update of issue is required");  
       }  
       else if($('#Updated_By').val() == '')  
       {  
            alert("Name is required");  
       }  
       else if($('#Updated_Date').val() == '')  
       {  
            alert("Current date is required");  
       }  

            $.ajax({  
                 url:"insert.php",  
                 method:"POST",  
                 data:$('#insert_form').serialize(),  
                 beforeSend:function(){  
                      $('#insert').val("Inserting");  
                 },  
                 success:function(data){  
                      $('#insert_form')[0].reset();  
                      $('#add_data_Modal').modal('hide');  
                      $('#employee_table').html(data);  
                 }  
            });  
       }  
  });  
  $(document).on('click', '.view_data', function(){  
       var employee_id = $(this).attr("jobNumber");  
       if(employee_id != '')  
       {  
            $.ajax({  
                 url:"select.php",  
                 method:"POST",  
                 data:{employee_id:employee_id},  
                 success:function(data){  
                      $('#employee_detail').html(data);  
                      $('#dataModal').modal('show');  
                 }  
            });  
       }            
  });  
 });

insert.php

<?php  
$connect = odbc_connect("Description=PCD_SQL_SERVER;DRIVER=SQL 
Server;SERVER=gbsuk0pcdspdsql","smtrfaUser","Summitdesk789"); 
if(!empty($_POST))  
{  
  $output = '';  
  $message = '';  
  $Update_Description = odbc_exec($connect, 
 $_POST["Update_Description"]);  
  $Updated_By = odbc_exec($connect, $_POST["Updated_By"]);  
  $Updated_Date = odbc_exec($connect, $_POST["Updated_Date"]);     
  if($_POST["problemDescription"] != '')  
  {  
       $query = "  
       UPDATE smtJobTracker   
       SET Update_Description='$Update_Description',   
       Updated_By='$Updated_By',   
       Updated_Date='$Updated_Date',       
       WHERE jobNumber='".$_POST["jobNumber"]."'";  
       $message = 'Data Updated';          
  }  
  else  
  {  
       $query = "  
       INSERT INTO smtJobTracker(Update_Description, Updated_By, 
 Updated_Date)  
       VALUES('$Update_Description', '$Updated_By', '$Updated_Date');  
       ";  
       $message = 'Data Inserted';  
  }  
  if(odbc_exec($connect, $query))  
  {  
       $output .= '<label class="text-success">' . $message . '</label>';  
       $select_query = "SELECT * FROM smtjobTracker ORDER BY jobNumber 
 DESC";  
       $result = odbc_exec($connect, $select_query);  
       $output .= '  
            <table class="table table-bordered">  
                 <tr>  
                                <th>Job Number</th>
                                <th>Description Of Issue</th>
                                <th>Edit</th>
                                <th>View</th>
                 </tr>  
       ';  
       while($row = odbc_fetch_array($result))  
       {  
            $output .= '  
                 <tr>  
                      <td>' . $row["jobNumber"] . '</td>  
                      <td><input type="button" name="edit" value="Edit" 
 id="'.$row["jobNumber"] .'" class="btn btn-info btn-xs edit_data" /> 
</td>  
                      <td><input type="button" name="view" value="view" 
 id="' . $row["jobNumber"] . '" class="btn btn-info btn-xs view_data" /> 
</td>  
                 </tr>  
            ';  
       }  
       $output .= '</table>';  
  }  
  echo $output;  
 }  
 ?>

The aim is an update of the record to include an update description, name of the updater and date updated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度