in Education by
I have a fileupload option in my project. It inclueds a query which returns a dataset. It works fine. But now i want to check whether the returning dataset is is empty or the same value i passed as a parameter to the query. Here is my back end code. .cs code if ((FileUpload1.HasFile))//&& (ext == ".pdf") { ds = db.checkExistingPDF(fileName); if (dbFileName != fileName) { this.FileUpload1.SaveAs(Path.Combine(svrPath, fileName + ".pdf")); ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", " alert('Successfully uploaded');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", " confirm ('Appeal is availbale for the this competition') ; ", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", " confirm ('Error') ; ", true); } Here is my query public DataSet checkExistingPDF(string fileName) { string strQuery = @"IF EXISTS (SELECT * FROM APPEAL_MASTER WHERE Attachment_upload = '"+ fileName +"')"; return SqlHelper.ExecuteDataset(strConnStringAppeal, CommandType.Text, strQuery); } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
To check dataset is empty or not You have to check null and tables count. Dataset ds=checkExistingPDF("filename"); if(ds != null && ds.Tables.count > 0) { // your code }

Related questions

0 votes
    How do I restrict records in a entity dataset to say five records. I have to list best sellers ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    So the problem is i don't get get a value from textbox field on GridView RowUpdating event. Here ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I have an XML document which basically looks like this: SomeSeller 2535 Now I'm trying to parse the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    Greetings! I have a DropDownList within a FormView which are bound to XmlDataSources: In the page's ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Greetings! I have a DropDownList within a FormView which are bound to XmlDataSources: In the page's ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    i create this class and it have this constructor : public class ReturnResult : ImplicitReturnResult { public bool ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I want to make a button Go To Cart visible after adding a product into cart. But when page gets ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    I have tried many solution online but I am unable to fix. First off all i check in bin and it ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am using MQTT client library from this link https://www.hivemq.com/blog/mqtt-client-library-encyclopedia- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have two submit buttons and a few textboxes on my page. When I enter details in the textbox and hit ... model.FirsttName) @Html.TextBoxFor(model => model.LastName) Get History...
asked May 22, 2022 in Education by JackTerrance
0 votes
    I have two submit buttons and a few textboxes on my page. When I enter details in the textbox and hit ... model.FirsttName) @Html.TextBoxFor(model => model.LastName) Get History...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have two submit buttons and a few textboxes on my page. When I enter details in the textbox and hit ... model.FirsttName) @Html.TextBoxFor(model => model.LastName) Get History...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am inserting JSON string into table, than on listing page in View inside foreach loop I want to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    For example, I have an ASP.NET form that is called by another aspx: string url = "http:// ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
...