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

  • SEARCH
  • Home
  • 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 8970673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:45:56+00:00 2026-06-15T17:45:56+00:00

I am getting an error when querying the value of an entry on another

  • 0

I am getting an error when querying the value of an entry on another page, just after it is inserted into the database. The error is as follows:

Value cannot be null or an empty string.
Parameter name: commandText

The Stack Trace looks like this (not sure if this helps):

[ArgumentException: Value cannot be null or an empty string.
Parameter name: commandText]
   WebMatrix.Data.Database.QueryValue(String commandText, Object[] args) +20791
   ASP._Page_EntryViewer_cshtml.Execute() in c:\Users\administrator.OKMCITY\Documents\My Web Sites\Persons Of Interest\EntryViewer.cshtml:101
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +151
   System.Web.WebPages.StartPage.RunPage() +17
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +114

The line the error occurs on (line 101):

Line 99:     var db = Database.Open("PersonsOfInterest");
Line 100:
Line 101:    var activeID = db.QueryValue((string)Session["activeEntrySelectQueryString"], (string)Session["gPOIName"], (string)Session["gDateLastModified"], (string)Session["gGender"], (string)Session["gRace"], (string)Session["gHeight"], (string)Session["gWeight"], (string)Session["gHairColor"], (string)Session["gEyeColor"], (string)Session["gDOB"], (string)Session["gAge"], (string)Session["gSS"], (string)Session["gDL"], (string)Session["gDOC"], (string)Session["gVehicleTag"], (string)Session["gFBI"], (string)Session["gOfficer"], (string)Session["gAdditionalDescriptors"], (string)Session["gHomePhone"], (string)Session["gAliases"], (string)Session["gSourceOfInformation"], (string)Session["gAddress"], (string)Session["gAddressInformation"], (string)Session["gKnownAssociates"], (string)Session["gVehicleDescription"], (string)Session["gCellPhone"], (string)Session["gCellPhone2"], (string)Session["gCellPhone3"], (string)Session["gPOICautions"], (string)Session["gComments"], (string)Session["gWorkPhone"], (string)Session["gSummarizedIncidents"], (string)Session["gPOILastName"]);
Line 102:    Session["gEntryID"] = activeID;
Line 103:   

I can’t seem to find a reason for this error, as it occurs just after a user “saves” his/her entry into the database but occurrs sporatically and seemingly randomly. The page attempts to query the value of the unique primary key for that entry. The values stored within the session variables you see above were stored from the values previously just used to insert the new entry into the database (I have to do it this way because the primary key “is identity” and the value is automatically incremented with each entry addition).

There may be a better (simpler) way to do what I am trying to do, but I thought doing it this way would be more consistent than simply using MAX (aggregate function) on just the primary key.

There is probably more information I could give on this issue, but I really don’t want to fill this page up with unnecessary information (if I haven’t already). Just let me know if there is anything else I can provide.

A few more notes:

The ‘Session[“gDateLastModified”]’ is grabbed from a field on the form that is automatically plotted using JavaScript, so this value (accurate down to the second) should (like all of the other variables in this query) match the values just entered into the database (Yes, I am sure that the user has JavaScript on and functioning correctly).

Also, it is probably obvious, but the QueryValue command on line 101 has the first argument as the select query string, using parameterized queries, of course, and the rest of the arguments are what must match to retrieve the row in the database.

Remember this error only occurs occasionally.

I am really sorry if I have added too much information (or left something out), but I don’t know where to begin assuming what this problem might be, so not sure what all might help any who are trying to help me. Just let me know if there is anything else I can provide.

UPDATE

All I know for now is that a string is deliberately filled as long as it ‘IsPost’ then that string is used to directly fill the Session variable in question. I know that session variables are actually cookies, but being pretty certain that no one is manually clearing them (and they’d have to do that after hitting the submit button and before the next page loads, somewhere in the middle of this process), what else could cause this value to become cleared? I assume that commandText is a variable that is passed the value of my query string during db.QueryValue, is this correct?

  • 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. Editorial Team
    Editorial Team
    2026-06-15T17:45:58+00:00Added an answer on June 15, 2026 at 5:45 pm

    I would check that the session actually has the values before using them:

    var activeEntrySelectQuery = (string) Session["activeEntrySelectQueryString"];
    if (string.IsNullOrEmpty(activeEntrySelectQuery)) {
        throw new ArgumentException("The active entry select query has gone missing.");
    }
    

    You could add appropriate additional information (and create your own type of exception) to help you find the issue. But I suspect this is the problem – the session doesn’t contain the value you expect.

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

Sidebar

Related Questions

Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
I'm querying a database and some of the results I'm getting are null. I'm
I am getting an error when querying a table in my MySQL database. It's
I am getting error in the sql statement. (server= RAJ-PC\SQLEXPRESS; user id=sa; password=as64ws; database=onlineshopping,
i am getting an error while querying this select statement. $comments = dbgetvar(SELECT SUM(CASE
I'm having trouble querying my SQLite database using Android. I keep getting either an
I'm querying a Facebook public JSON feed. I'm getting an error: -[__NSCFString objectForKey:]: unrecognized
I am getting this error when I try to query the database and write
getting error while try to start service
Getting error when I tried like this: $ci =& get_instance(); $ci->db->select(CONCAT_WS(' ',users.name_first,users.name_last) AS user_name,CONCAT_WS('

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.