Skip to content
Advertisement

SQL Server Returning Invalid (unicode/hexidecimal) Characters In Result

When querying a list of large NTEXT SQL columns, I have started with more frequency getting garbage back in the query results. I’m not sure if CISCO VPN is causing the problem or some other type of ‘driver’ (either network driver, wifi driver, language setting on my laptop?). I’m at a total loss. But you can see the failure in my screen shot below. Note the one ‘Success’ line dumped out, so that means it worked once but failed the second time. I get random number of successes, then it fails.

I’ve had other people try the same script while connected to the same VPN (however they are in different location and obviously a different computer) and they can run it without error. One person ran it 5 times (so 50 success queries).

Failure

I’m using LINQPad (and obviously LINQ to SQL) as the test harness and here is my script. It is just a simple script to loop FolderItem.fiItem columns (NTEXT) and parses them into XML and add it to a root element. You can see I tried direct L2S querying along with using the ExecuteCommand method to see if it had any affect on the outcome but nothing changed.

UPDATE – I just connected to my phone hotspot instead of my regular WIFI (amplifi routers) and it made it through the script without error. I’m seriously at a loss of what to look at to try and solve, but when connected to my WIFI with VPN, my download speed is around 80MB. Any ideas/suggestions?

Script

void Main()
{
    var query = @"SELECT [t0].[fiEntryType], [t0].[fiItem]
    FROM[dbo].[FolderItems] AS[t0]
    LEFT OUTER JOIN[dbo].[Groups] AS[t1] ON[t1].[gKey] = [t0].[figKey]
    WHERE[t1].[gName] = 'Tables';";

    var tables = new XElement("Tables" );

    for (int i = 0; i < 10; i++)
    {
        // var folderItems = FolderItems.Where(f => f.Group.gName == "Tables").Select(f => new { f.fiEntryType, f.fiItem });
        var folderItems = ExecuteQuery<TableResult>(query, new object[] { });

        foreach (var fi in folderItems)
        {
            try
            {
                tables.Add(XElement.Parse($"<Table>{fi.fiItem}</Table>"));
            }
            catch (Exception ex)
            {
                fi.Dump();
                throw;
            }
        }

        // tables.Dump();
        "Success".Dump();

        Thread.Sleep( 1000 );
    }
}

// Define other methods and classes here
public class TableResult
{
    public string fiEntryType {get;set;}
    public string fiItem {get;set;}
}

Advertisement

Answer

Can’t really explain all the behavior but changing my VPN software from Cisco to Shrewsoft solved the issue. Shrewsoft has been very solid since install.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement