Can anyone help me with this stored procedure.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ssmeshack
    New Member
    • Jul 2008
    • 38

    Can anyone help me with this stored procedure.

    Hi,

    Im using stored procedure to update data. but the problem is after click update there is no change.

    can anyone check this stored procedure and tell what s the problem.

    Code:
    CREATE PROCEDURE UpdateTicket
    
        @TicID int = '',
      --  @TicDate datetime = '',
        @TicCreateBy   varchar(50) ='',
        @TicCustomer      varchar(50) ='',
        @TicOwner     varchar(50) ='',
        @TicIssueType varchar(50) ='',
        @TicIssue     varchar(100) ='',
        @TicStatus varchar(50) = '',
    --    @TicStatusID varchar(10) = '',
        @TicPriorityID varchar(4) = '',
        @TicPriority varchar(50) ='',
        @TicAction varchar(500)=''
    
     AS
    
    UPDATE Ticket
    
    SET 
    
    --TicDate=@TicDate,
    TicCreateBy=@TicCreateBy,
    TicCustomer=@TicCustomer,
    TicOwner=@TicOwner,
    TicIssueType=@TicIssueType,
    TicIssue=@TicIssue,
    TicStatus=@TicStatus,
    --TicStatusID=@TicStatusID,
    TicPriorityID=@TicPriorityID,
    TicPriority=@TicPriority,
    TicAction=@TicAction
    
    WHERE TicID=@TicID
    GO
    thank you.

    Meshack
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Do you get any error messages?
    There could be several reasons why the update may not be happening. You have to provide more details. How are are you calling the stored procedure?

    Comment

    • ssmeshack
      New Member
      • Jul 2008
      • 38

      #3
      Originally posted by r035198x
      Do you get any error messages?
      There could be several reasons why the update may not be happening. You have to provide more details. How are are you calling the stored procedure?
      Hi,
      Thanks. There is no error showing. But when I click the update button there is no update happens.

      Here is the method for calling the stored procedure:
      Code:
      protected void btnUpdate_Click(object sender, EventArgs e)
          {
              System.Data.SqlClient.SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=DBhelpdesk; Integrated Security=SSPI;");
              conn.Open();
              System.Data.SqlClient.SqlCommand comm = new SqlCommand("UpdateTicket", conn);
              comm.CommandType = CommandType.StoredProcedure;
      
              //string sUserName = Request.Cookies["UserName"].Value;
             
              //comm.Parameters.AddWithValue("@TicDate", Convert.ToDateTime(lbTimeDate.Text));
              comm.Parameters.AddWithValue("@TicCreateBy", tbCreateBy.Text);
              comm.Parameters.AddWithValue("@TicCustomer", tbCustomer.Text);
              comm.Parameters.AddWithValue("@TicOwner", lblOwner.Text);
              comm.Parameters.AddWithValue("@TicIssueType", ddlIssue.Text);
              comm.Parameters.AddWithValue("@TicIssue", tbIssue.Text);
              comm.Parameters.AddWithValue("@TicStatus", ddlStatus.Text);
              comm.Parameters.AddWithValue("@TicPriorityID", lblPriorityID.Text);
              comm.Parameters.AddWithValue("@TicPriority", ddlPriority.Text);
              comm.Parameters.AddWithValue("@TicAction", tbAction.Text);
              comm.ExecuteNonQuery();
              //Response.Write("The Data Have Been Add To Database.");
              //lblRecordV.Text = "The data have been updated to database!";
              conn.Close();
              Response.Redirect("Dashboard2.aspx");
          }
      Im doing update in panel. Start from the gridview, when click edit hyperlink field, it will show the update panel.

      Here the panel and form code:
      Code:
      <asp:Panel ID="pnlUpdate" runat="server" Visible="false">
                      <table cellpadding="5" cellspacing="5" class="style37" 
                          style="border: thin solid #EEF2FB; table-layout: fixed;">
                          <tr>
                              <td class="style77" colspan="6">
                                  Update</td>
                          </tr>
                          <tr>
                              <td class="style94">
                                  Ticket ID :</td>
                              <td class="style88">
                                  <asp:Label ID="lblTicID" runat="server"></asp:Label>
                              </td>
                              <td class="style92">
                              </td>
                              <td class="style81">
                              </td>
                              <td class="style56">
                                  <span class="style95">Date</span> <span class="style95">:</span></td>
                              <td class="style57">
                                  <asp:Label ID="lbTimeDate" runat="server" Font-Bold="False"></asp:Label>
                              </td>
                          </tr>
                          <tr>
                              <td class="style94">
                                  C<span>reated By :</span></td>
                              <td class="style88">
                                  <b><span class="style93">
                                  <asp:TextBox ID="tbCreateBy" runat="server" Height="22px" 
                                      ontextchanged="tbCreateBy_TextChanged" style="font-family: 'Times New Roman'" 
                                      Width="120px"></asp:TextBox>
                                  </span></b>&nbsp;</td>
                              <td class="style96">
                                  Issue Type :</td>
                              <td class="style81">
                                  <b><span class="style93">
                                  <asp:DropDownList ID="ddlIssue" runat="server" AutoPostBack="True" 
                                      onselectedindexchanged="DropDownList2_SelectedIndexChanged" 
                                      style="font-family: 'Times New Roman'">
                                      <asp:ListItem></asp:ListItem>
                                      <asp:ListItem Value="Internet">Internet</asp:ListItem>
                                      <asp:ListItem Value="PC Hardware">PC Hardware</asp:ListItem>
                                  </asp:DropDownList>
                                  </span></b>&nbsp;</td>
                              <td class="style56">
                              </td>
                              <td class="style57">
                                  <asp:Label ID="lblPriorityID" runat="server" Font-Bold="False" 
                                      ForeColor="Black" Visible="False"></asp:Label>
                              </td>
                          </tr>
                          <tr>
                              <td class="style91">
                                  Customer :</td>
                              <td class="style89">
                                  <b><span class="style93">
                                  <asp:TextBox ID="tbCustomer" runat="server" 
                                      ontextchanged="tbCustomer_TextChanged" style="font-family: 'Times New Roman'" 
                                      Width="120px"></asp:TextBox>
                                  </span></b>&nbsp;</td>
                              <td class="style82">
                                  Priority :</td>
                              <td class="style72">
                                  <b><span class="style93">
                                  <asp:DropDownList ID="ddlPriority" runat="server" 
                                      onselectedindexchanged="DropDownList3_SelectedIndexChanged" 
                                      style="font-family: 'Times New Roman'" Width="103px">
                                      <asp:ListItem></asp:ListItem>
                                      <asp:ListItem Value="Normal">Normal</asp:ListItem>
                                      <asp:ListItem Value="High">High</asp:ListItem>
                                      <asp:ListItem Value="Critical">Critical</asp:ListItem>
                                  </asp:DropDownList>
                                  </span></b>&nbsp;</td>
                              <td class="style73">
                                  Status :</td>
                              <td class="style74">
                                  <b><span class="style93">
                                  <asp:DropDownList ID="ddlStatus" runat="server" Height="22px" 
                                      onselectedindexchanged="DropDownList1_SelectedIndexChanged" 
                                      style="font-family: 'Times New Roman'" Width="120px">
                                      <asp:ListItem></asp:ListItem>
                                      <asp:ListItem Value="No Action">No Action</asp:ListItem>
                                      <asp:ListItem Value="Pending">Pending</asp:ListItem>
                                      <asp:ListItem Value="Resolved">Resolved</asp:ListItem>
                                  </asp:DropDownList>
                                  </span></b>&nbsp;</td>
                          </tr>
                          <tr>
                              <td class="style83" colspan="6">
                                  <span class="style95">Owner :</span>
                                  <asp:Label ID="lblOwner" runat="server" Font-Bold="False"></asp:Label>
                              </td>
                          </tr>
                          <tr>
                              <td class="style97" colspan="6">
                                  Issue :</td>
                          </tr>
                          <tr>
                              <td class="style39" colspan="6">
                                  <b><span class="style93">
                                  <asp:TextBox ID="tbIssue" runat="server" Height="80px" 
                                      ontextchanged="TbIssue_TextChanged" style="font-family: 'Times New Roman'" 
                                      TextMode="MultiLine" Width="433px"></asp:TextBox>
                                  </span></b>
                              </td>
                          </tr>
                          <tr>
                              <td class="style85" colspan="6">
                                  Action Taken :</td>
                          </tr>
                          <tr>
                              <td class="style39" colspan="6">
                                  <asp:TextBox ID="tbAction" runat="server" Height="80px" 
                                      ontextchanged="tbAction_TextChanged" style="font-family: 'Times New Roman'" 
                                      TextMode="MultiLine" Width="433px"></asp:TextBox>
                              </td>
                          </tr>
                          <tr>
                              <td class="style16" colspan="6">
                                  &nbsp;&nbsp;&nbsp; &nbsp;<asp:Button ID="btnUpdate" runat="server" onclick="btnUpdate_Click" 
                                      Text="Update" />
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btnCancel" runat="server" onclick="btnCancel_Click" 
                                      Text="Cancel" />
                                  &nbsp;&nbsp;</td>
                          </tr>
                      </table>
                  </asp:Panel>
      Thank you for your help.

      Meshack.

      Comment

      Working...