i want if caseid , pin and mobile is available in database table then its shows "success" otherwise "error" . i am using stored procedure to check and asp.net webform for backend..below is the code
Stored Proc
create PROCEDURE [dbo].[usp_Download_report] @CaseID nvarchar(50), @Pin nchar(6), @MobileNo nvarchar(12) AS BEGIN Declare @CountR int Select @CountR=count(*) from [MedleaprLAB].[dbo].[reportdownloadpin] where CaseID=@CaseID and Pin=@Pin end
aspx page
<div class="card-body " id="searchcasediv" runat="server"> <div class="form-group row">
<div class="col-md-6"> <div class="row"> <div class="col-md-4">
<asp:Label ID="lblcaseid" runat="server" Text="CaseID"></asp:Label> </div> <div class="col-md-5"> <asp:TextBox ID="txtcaseid" runat="server" CssClass="form-control" placeholder="CaseId"></asp:TextBox> </div>
</div>
</div> </div>
<div class="form-group row">
<asp:Label ID="lblmobile" runat="server" Text="MobileNo"></asp:Label> </div> <div class="col-md-5"> <asp:TextBox ID="txtmobileno" runat="server" CssClass="form-control" placeholder="MobileNo"></asp:TextBox> </div>
<asp:Label ID="lblpin" runat="server" Text="Key(received on mobile)"></asp:Label> </div> <div class="col-md-5"> <asp:TextBox ID="txtpin" runat="server" CssClass="form-control" placeholder="Key"></asp:TextBox> </div>
</div> </div> <div class="form-group row">
<div class="col-md-6"> <div class="row"> <div class="col-md-6"> <div class="col-md-5"> <asp:Button ID="btnsubmit" runat="server" CssClass="btn btn-primary" Text="Submit" OnClick="btnsubmit_Click"></asp:Button>
</div> </div> </div>
<asp:Label ID="lblmsg" runat="server"></asp:Label>
aspx.cs
protected void btnsubmit_Click(object sender, EventArgs e) { fill_downloadreport(); }
protected void fill_downloadreport() { try { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_Download_report";
cmd.Parameters.AddWithValue("@CaseID", txtcaseid.Text.Trim()); cmd.Parameters.AddWithValue("@MobileNo", txtmobileno.Text.Trim()); cmd.Parameters.AddWithValue("@Pin", txtpin.Text.Trim());
int result = db.DmlQuery(cmd, "Databsename");
if (result == 1) { lblmsg.Text = result.ToString(); } else { lbl_msg.Text = result.ToString(); }
}