Access database_DriPro

Ejemplos y plantillas para Autoplay Media Studio.
HIDE: ON
Hidebb Message Hidden Description





Imagen




Imagen


Script
function xMDBCreateDB(xMDBdb, xMDBPassword)
	local xMDBresult = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xMDB.dll", "Create_MDB", "\""..xMDBdb.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
	return xMDBresult;
end

function xMDBQueryToTable(xMDBdb, xMDBQuery, xMDBPassword)
	if xMDBdb ~= "" then
		if File.DoesExist(xMDBdb) then
			if xMDBQuery ~= "" then
				-- Define variables:
				local Rows = 0;
				local Columns = 0;
				local ColumnNames = {};
				local Data = {};

				local xMDBresult = DLL.CallFunction(_SourceFolder .. "\\Data\\Scripts\\xMDB.dll", "Query_Select_MDB", "\""..xMDBdb.."\",\""..xMDBQuery.."\",\""..xMDBPassword.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);

				if String.Left(xMDBresult, 5) ~= "Error" then
					if xMDBresult ~= "NO_DATA" then
						-- Get all the rows returned
						tbl = DelimitedStringToTable(xMDBresult, "||");

						if tbl then
							-- Get column names from first row
							tblCols = DelimitedStringToTable(tbl[1], ";;");

							if tblCols then
								-- Loop through the columns
								for nCol = 1, Table.Count(tblCols) do
									Columns = Columns + 1;
									ColumnNames[Columns] = tblCols[nCol];
								end
							end

							-- Get the data
							for nRow = 2, Table.Count(tbl) do
								Rows = Rows + 1;
								Data[Rows] = {};;
								tblRow = DelimitedStringToTable(tbl[nRow], ";;");

								if tblRow then
									for nCol = 1, Table.Count(tblRow) do
										Data[Rows][ColumnNames[nCol]] = tblRow[nCol];
									end
									
								end
								
							end

							tbl = nil;
							tblCols = nil;
							tblRow = nil;
							return {Rows = Rows,Columns = Columns,ColumnNames = ColumnNames,Data = Data};
						else
							return "NO_DATA";
						end
					else
						return xMDBresult;
					end
				else
					return xMDBresult;
				end
			else
				return "Error";
			end
		else
			return "Error";
		end
	else
		return "Error";
	end
end

function xMDBQuery(xMDBdb, xMDBQuery, xMDBPassword)
	if xMDBdb ~= "" then
		if File.DoesExist(xMDBdb) then
			if xMDBQuery ~= "" then
				local xMDBresult = DLL.CallFunction(_SourceFolder .. "\\Data\\Scripts\\xMDB.dll", "Query_Update_MDB", "\""..xMDBdb.."\",\""..xMDBQuery.."\",\""..xMDBPassword.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
				return xMDBresult;
			else
				return "Error";
			end
		else
			return "Error";
		end
	else
		return "Error";
	end
end

xMDB = {};
xMDB.CreateDB = xMDBCreateDB;
xMDB.Query = xMDBQuery;
xMDB.QueryToTable = xMDBQueryToTable
Gracias, DriPro, eres el puto amo. :friends:
Muchas gracias por este ejemplo....
thnkssssssssssssssssss
Thank you