Jump to content

sql command


Recommended Posts

I'm trying to switch a script from sqlite to sql at work to work on our network but I can find any way to get the last inserted row like "_SQLite_LastInsertRowID" everything that I try that I find in a search online says to use @@identity or scope_identity() but they return nothing at all. they say to just do a "select scope_identity()" and you'll get the last inserted row, but I just get an empty value.

this is an small example of what I'm working with.

CODE
#include "Mask\MaskMSSQL.au3"

Global $db ; databases

$db = SQL_Startup(@ComputerName & "\SQLEXPRESS", "cc") ; mssql

$value = _SQL_Execute($db, "insert into holders (name) values ('test1');")

$value = _SQL_Execute($db, "SELECT @ID")

MsgBox(0, "", $value)

Func OnAutoItExit()

SQL_Exit()

EndFunc ;==>OnAutoItExit

Gnatwork Networks

Link to comment
Share on other sites

What SQL UDF are you using? This one? If so you aren't using it correctly. It clearly says in the source code that _SQL_Execute returns a handle to a query. You need to call _SQL_FetchData after or _SQL_QuerySingleRow instead of _SQL_Execute.

Follow the example that is provided.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...