none
LDDatabase Error SQL Server 2014 Express RRS feed

  • Question

  • Show NFZ815 for insert data to a Testdatenbank.

    Here the error:

    Here the Database

    I dont know the correct command for lddatabase.getdatabase.

    Please help me.


    Best Regards Martin


    • Edited by martmen Saturday, September 19, 2015 8:27 PM
    Saturday, September 19, 2015 8:25 PM

Answers

  • To connect to any database you need a connection string.  For the MySql, we can create a default one using the input parameters, server user & password.  If these are not sufficient you can set the connection string you want with LDDatabase.Connection.

    So I don't know what your connection string should be, however you are appear to be using ConnectMySql command and a SqlServer database (use ConnectSqlServer) - so first choose the right database type, then set the connection string if it doesn't work from the defaults.

    Step 1] Use the right connection command (MySql, SqlServer etc) for the database type you are using

    Step 2] Work out the connection string, and set this with LDDatabase.Connection before doing the connection.

    On Step 2 there should be some doccumentation somewhere to what the connectin string is Google "sql server connection string" to start finding what this string should be.

    See this thread for similar issue with ODBC database

    https://social.msdn.microsoft.com/Forums/en-US/585f71c5-d7a2-4303-8374-9d2019a6f49c/odbc-not-working?forum=smallbasic

    MY SqlServer test uses the following, but yours may be different:

    database = LDDataBase.ConnectSqlServer("(local)\SQLEXPRESS","TEST")

    Looking at your images, yours may be:

    database = LDDataBase.ConnectSqlServer("(local)\INSTANZI","Testdatenbank")

    • Edited by litdevModerator Sunday, September 20, 2015 4:24 PM
    • Marked as answer by martmen Monday, September 21, 2015 3:50 PM
    Sunday, September 20, 2015 10:25 AM
    Moderator

All replies

  • To connect to any database you need a connection string.  For the MySql, we can create a default one using the input parameters, server user & password.  If these are not sufficient you can set the connection string you want with LDDatabase.Connection.

    So I don't know what your connection string should be, however you are appear to be using ConnectMySql command and a SqlServer database (use ConnectSqlServer) - so first choose the right database type, then set the connection string if it doesn't work from the defaults.

    Step 1] Use the right connection command (MySql, SqlServer etc) for the database type you are using

    Step 2] Work out the connection string, and set this with LDDatabase.Connection before doing the connection.

    On Step 2 there should be some doccumentation somewhere to what the connectin string is Google "sql server connection string" to start finding what this string should be.

    See this thread for similar issue with ODBC database

    https://social.msdn.microsoft.com/Forums/en-US/585f71c5-d7a2-4303-8374-9d2019a6f49c/odbc-not-working?forum=smallbasic

    MY SqlServer test uses the following, but yours may be different:

    database = LDDataBase.ConnectSqlServer("(local)\SQLEXPRESS","TEST")

    Looking at your images, yours may be:

    database = LDDataBase.ConnectSqlServer("(local)\INSTANZI","Testdatenbank")

    • Edited by litdevModerator Sunday, September 20, 2015 4:24 PM
    • Marked as answer by martmen Monday, September 21, 2015 3:50 PM
    Sunday, September 20, 2015 10:25 AM
    Moderator
  • Hi litdev,

    sometimes i am so ... :-)

    Show VGT754 it is running. By SQL Server 2014 i do not use the command LDDataBase.ConnectMySQL. The right command is LDDataBase.ConnectSqlServer.


    Best Regards Martin

    Monday, September 21, 2015 3:50 PM
  • I think your code should be:

    db = LDDataBase.ConnectSqlServer("MM\INSTANZ1", "TestDatenbank")
    command = "BEGIN TRANSACTION;"
    command = command + "INSERT into Personen(PersonID,VorName,NachName,PflegeDatum) VALUES ('1','Martin','Menze','19590807 05:50');"
    command = command + "COMMIT;"
    LDDataBase.Command(db, command)

    Monday, September 21, 2015 7:19 PM
    Moderator