Results 1 to 1 of 1

Thread: Illegal Characters in Path

  1. #1
    bpeirson is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2010
    Location
    United States
    Posts
    6
    Reputation
    0

    Illegal Characters in Path

    I've seen questions on this topic around the web (I really try Google before asking...) but I haven't seen one that works/makes sense for the particular line in my program that is giving an error. Part of my confusion is that a month or so ago this was working fine with no change to the relevant code...

    I have data coming in from some sensors that I am storing in an SQL Server CE databasae. I'm debugging the program from a flash drive given that my docs is a network share and CE doesn't like that. The SQL connection routine is almost identical to the routine I always use on a full blown SQL database. The biggest difference is with a local database I've had to add the install path of the program.

    Code:
            SQL_Server = System.Configuration.ConfigurationManager.AppSettings("SQL_Server")
            SQL_Password = System.Configuration.ConfigurationManager.AppSettings("SQL_Password")
    
            Try
                SQL_Con.ConnectionString = "Data Source = " & (System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)) & "\\" & SQL_Server & "; Password = " & SQL_Password
                'SQL_Con.ConnectionString = "Data Source = " & SQL_Server & "; Password = " & SQL_Password
    
                SQL_Con.Open()
    
            Catch ex As Exception
                MessageBox.Show("Error while connecting to SQL Server." & ex.Message)
            End Try
    That doesn't throw the error. That's happy. In fact there are variables in that database that my program is pulling out nicely. The problem is when I try to read out the variables into a dataset to display a chart. The specific line is:

    Code:
    Me.PatientResultsTableAdapter.Fill(Me.dsForce.PatientResults)
    The program throws an illegal characters in path exception on this line. I have thrown a line in elsewhere to put the path in a text box just to see what it's getting and it looks good.

    What has me scratching my head is that if the path had illegal characters in it, wouldn't the SQL connection throw that exception first?

    Any suggestions would be appreciated.
    Last edited by bpeirson; 04-09-2012 at 8:31 PM. Reason: Apparently the code shortcut puts in [xcode] instead of [code]...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking