Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 179693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:27:08+00:00 2026-05-11T14:27:08+00:00

The two procedures, SearchMaster and SearchDetails work if I run it in Sql Management

  • 0

The two procedures, SearchMaster and SearchDetails work if I run it in Sql Management Studio and SearchMaster even runs fine when I am Testing the Query when I set up the stored procedure in design view, but when I run it, no rows are created if I enter just info for the frn or business. If I enter for both, I do get data if there is a match. Are the parameters etup correctly? Also, if I am initializing the parameters to null in the procedure, is it still necessary to use ConvertEmptyStringToNull?

Here is the SearchMaster StoredProcedure:

CREAETE PROCEDURE SearchMaster @business nvarchar(300) = NULL, @frn nvarchar(10) = NULL AS SELECT h.Business,        hrl.frn FROM registration hrl INNER JOIN holder h on h.call = hrl.call WHERE (@business IS NULL OR h.Business like '%' + @business + '%')  AND (@frn IS NULL OR hrl.frn = @frn) 

Here is the SearchDetails StoredProcedure:

CREATE PROCEDURE SearchDetails @business nvarchar(300) = NULL, @frn nvarchar(10) = NULL AS SELECT hrl.call  FROM registration hrl  INNER JOIN holder h ON h.call = hrl.call WHERE (@business IS NULL OR h.Business LIKE '%' + @business + '%')    AND (@frn IS NULL OR hrl.frn = @frn) 

Here is the SqlDataSource for the SearchMaster procedure:

<asp:SqlDataSource ID='sqlDsDetails'                 runat='server'                 ConnectionString='<%$ ConnectionStrings:cnxString %>                SelectCommandType='StoredProcedure'                 SelectCommand='SearchMaster'> <SelectParameters> <asp:ControlParameter Name='business' ControlID='txtBusiness'                    Type='String' PropertyName='Text'                     ConvertEmptyStringToNull='true' /> <asp:ControlParameter Name='frn' ControlID='txtFRN'                    Type='String' PropertyName='Text'                   ConvertEmptyStringToNull='true'/> </SelectParameters> </asp:SqlDataSource> 

Here is the SqlDataSource for the SearchDetails procedure:

<asp:SqlDataSource ID='sqlDsDetails'                 runat='server'                 ConnectionString='<%$ ConnectionStrings:cnxString %>                SelectCommandType='StoredProcedure'                 SelectCommand='SearchDetails'> <SelectParameters> <asp:Parameter Name='frn' Type='String' DefaultValue=''             ConvertEmptyStringToNull='true' /> <asp:Parameter Name='business' Type='String' DefaultValue=''             ConvertEmptyStringToNull='true' /> </SelectParameters> </asp:SqlDataSource> 

Here is the button click that binds the SqlDsMaster:

protected void btnSearch_Click(object sender, EventArgs e) {     sqlDsMaster.DataBind(); } 

Here is the gvMaster_RowCreated that creates the rows for the details:

protected void gvMaster_RowCreated(object sender, GridViewRowEventArgs e) {     if (e.Row.RowType == DataControlRowType.DataRow)     {         SqlDataSource ctrl =          e.Row.FindControl('sqlDsDetails') as SqlDataSource;          if (ctrl != null && e.Row.DataItem != null)         {             ctrl.SelectParameters['frn'].DefaultValue =              ((DataRowView)e.Row.DataItem)['frn'].ToString();              ctrl.SelectParameters['business'].DefaultValue =              ((DataRowView)e.Row.DataItem)['business'].ToString();          }      }  } 

I ran the SQL Profiler and when only one parameter was entered, the profiler did not even show the procedure running. When I entered both parameters, the procedure was shown running in the profiler.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:27:08+00:00Added an answer on May 11, 2026 at 2:27 pm

    My guess would be that it is still passing in an empty string for what you consider the null case. You could rule this out by doing:

    CREATE PROCEDURE SearchDetails @business nvarchar(300) = NULL, @frn nvarchar(10) = NULL AS  SELECT @business = NULLIF(@business, ''),        @frn = NULLIF(@frn, '')   SELECT hrl.call // etc 

    If it starts working, it was passing in empty strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 235k
  • Answers 235k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I suggest you install XML::XPath May 13, 2026 at 6:12 am
  • Editorial Team
    Editorial Team added an answer I would encourage you to use event delegation. For instance… May 13, 2026 at 6:12 am
  • Editorial Team
    Editorial Team added an answer From the Microsoft Connect issue: Security attributes need to be… May 13, 2026 at 6:12 am

Related Questions

I have two stored procedures I wish to use in my stored procedure, but
I have the following two procedures defined in my AppDelegate. saveSettings and loadSettings. I
I've written a paged search stored procedure using SQL Server 2005. It takes a
There are two procedures, A1 and A2, which both call function B in their

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.