Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, this probably isn't a C# question except to say that you should likely learn the...</p> <pre><code>string strSql = @"SELECT * FROM TABLE"; </code></pre> <p>syntax so that 1.) You can do away with all the <code>" +</code> stuff and 2.) You can cut and paste something in from an isql client.</p> <p>So what you really want to do is...</p> <ol> <li>Debug in your IDE by setting a breakpoint at that last line, </li> <li>Hover your cursor over <code>sqlQueryString</code>, </li> <li>Right-click <code>sqlQueryString</code> in the "floater" that appears (I put my mouse over <code>strReturn</code>, the floater comes up. Right click the <code>strReturn</code> that appears floating above -- blue rectangle is what you want)</li> </ol> <p><img src="https://i.stack.imgur.com/uuhEa.png" alt="floater from Visual Studio of a var"></p> <ol start="4"> <li>Select the option to copy the <em>value</em>.</li> <li>Paste your clipboard with <code>sqlQueryString</code>'s contents into Notepad, gvim, whatever.</li> <li><strong>Let us know what that says.</strong> </li> <li>Then tell us <a href="https://stackoverflow.com/a/1706257/1028230">precisely what happens when you run that statement directly against the database</a>. </li> </ol> <p>You might also give us some idea of what you expected to happen [based on having run the original query against the database earlier, perhaps].</p> <p>And then accept that even the best of us occasionally lose an hour or two doing something dumb with SQL. ;^) With the above information, however, we could probably help cut that down a bit.</p> <p><strong>EDIT:</strong> Rather, if, as your comment suggests, the query works when run directly against (MS-SQL Server?), the C# issue potentially comes <em>after</em> this code, when you run it against the database. First do the above and ensure what's in sqlQueryString is what you ran against the db.</p> <p><strong>EDIT2:</strong> Made the debug steps into a bulleted list to make them more obvious. Don't just tell us it work; tell us what was in <code>sqlQueryString</code>. <strong>But, again, as with the first edit, if that string is okay, your problem likely occurs later on in your C# code.</strong> </p> <p>Are you immediately throwing against the database? What's that code look like?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload