Announcement

Collapse
No announcement yet.

'SQLiteConnection' is not defined.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    'SQLiteConnection' is not defined.

    Hello people,

    I get this set of errors running this script on my controller (S6). Running this script in development using TesScripting, it runs fine. Ideas?

    ...

    Compiling script C:\Program Files\HomeSeer HS3\scripts\Test.vb: Type 'SQLiteConnection' is not defined.

    Compiling script C:\Program Files\HomeSeer HS3\scripts\Test.vb: Namespace or type specified in the Imports 'System.Data.SQLite' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    Compiling script C:\Program Files\HomeSeer HS3\scripts\Test.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    Imports System.Data.SQLite
    Imports System.Text

    ...

    Dim cmdString As New StringBuilder
    Dim cn As New SQLiteConnection(cnString)
    cmdString.AppendLine("SELECT PhoneID, Name FROM Users;")
    Dim cmd As New SQLiteCommand(cmdString.ToString, cn)
    Dim dr As SQLiteDataReader
    cn.Open()

    dr = cmd.ExecuteReader()
    While dr.Read()
    Dim u As User
    u.PhoneID = dr.GetString(0).ToString()
    u.Name = dr.GetString(1).ToString()
    usersList.Add(u)
    End While

    cn.Close()
    cn.Dispose()

    End Sub

    #2
    Have you added the SQLite DLL to the ScriptingReferences line in your settings.ini file?

    Comment


      #3
      No I have not. Could you give me an example please sir. Not exactly sure on the syntax.

      J

      Comment


        #4
        Originally posted by jsyers View Post
        No I have not. Could you give me an example please sir. Not exactly sure on the syntax.

        J
        Open your settings.ini and look at the ScriptingReferences line - you may or may not already have one it does depend.

        If you don't have one add

        Code:
        ScriptingReferences=System.Data.SQLite;C:\HS3\Bin\System.Data.SQLite.dll
        I would suggest it may be worth putting the SQLite DLL in a directory similar to the above, I think now with plugins that use SQLite if you leave it in the root HS directory you could end up with issues.

        If you already have an entry then add System.Data.SQLite;C:\HS3\Bin\System.Data.SQLite.dll to the existing entry ensuring that you separate it from the last entry by a comma. For example mine looks like;

        Code:
        ScriptingReferences=DDay.ical;DDay.ical.dll,antlr.runtime;antlr.runtime.dll,DDay.Collections;DDay.Collections.dll,System.Web.Extensions;System.Web.Extensions.dll,System.Data.SQLite;C:\HS3\Bin\System.Data.SQLite.dll,System.Data;System.Data.dll,System.Windows.Forms;System.Windows.Forms.dll

        Comment


          #5
          mrhappy

          Again you saved my caboose, Thank you! I can confirm that system.data.sqlite.dll does not play nice in \bin. Moved it into \bin\MyHomeSeer, made the change to settings.ini and works like a champ.

          J

          Comment

          Working...
          X