Is a string constant different to a string?

I use an encryption key for a local sqlite database. I want to put the string in a constant, don’t worry about encoding or hashing it up to disguise against hex editing for the time being.

If i create a string constant ‘encryptkey’ and store the password in it the database will not open;

  devpass=encryptkey
  opendatabase \\\\method to open the database and get data

However the below works fine.

  devpass="The Password"
  opendatabase \\\\method to open the database and get data

Checking the ‘hex’ of the encryptkey variable shows the contents as they should be with no extra characters.

Encryptkey is public, is being found but does not match the database password unlike the latter method.

Any ideas, is it a bug or am I missing something?

Encodings?

You do not explain how and that is the reason why …

You can declare a Const with a string, but only with the following syntax:

Const Foo = "My nice Constant."

This syntax is rejected:

Dim The_Date As New Date Const Foo = "Error on " + The_Date.SQLDate + "."

Try the second code above and read the error message.

I create a constant under App of type string and make the default value the password.

Different case. OK.

Do you have the same problem changing its type String/Text?

If that is the case, your code should fail. App.encryptkey is not the same as encryptkey. If your code compiles, then it is not accessing the constant under App. It’s using something else.

Thanks for all the suggestions, I’ll revisit when i get a chance later today and see what i come up with.

Thanks, finally got around to looking at this, operator error, two strings looking at different places :slight_smile: