Hello,
with this library it is possible to access MSSQL databases and execute SQL queries (e. g. Select, Insert Into, Update, Drop Table,...) without ODBC.
Functions: - ExecuteSQLQuery()
- Syntax:
Code:
Result = ExecuteSQLQuery(ConnectionString$, SQL$, Timeout, @Output, @ErrorOutput)
- Description: Executes an SQL query.
- Parameter:
- ConnectionString$: Connection data for the server and the database.
- SQL$: SQL code to execute a query.
- Timeout: Time in seconds, how long the process should be waited for. If 0 is specified, it waits until the operation is complete.
- @Output: The result of the query is stored in XML format in the string variable.
- @ErrorOutput: If an error occurs, the error message is stored in the string variable.
- Return value:
- 0: The process was successful.
- Example:
Code:
EnableExplicit
Global PBEx_MSSQL
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
PBEx_MSSQL = OpenLibrary(#PB_Any, "PB.Ex_MSSQL_x86.dll")
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
PBEx_MSSQL = OpenLibrary(#PB_Any, "PB.Ex_MSSQL_x64.dll")
CompilerEndIf
If PBEx_MSSQL
Prototype ExecuteSQLQuery(ConnectionString.p-Unicode, SQL.p-Unicode, Timeout, Output, ErrorOutput)
Global ExecuteSQLQuery.ExecuteSQLQuery = GetFunction(PBEx_MSSQL, "ExecuteSQLQuery")
Define Output$ = Space(1000000)
Define ErrorOutput$ = Space(1024)
If ExecuteSQLQuery("Server=YourServer;Database=YourDatabase;User Id=YourUsername;Password=YourPassword;", "SELECT * FROM MyTable", 0, @Output$, @ErrorOutput$) = 0
ParseXML(1, Output$)
FormatXML(1, #PB_XML_WindowsNewline | #PB_XML_ReFormat | #PB_XML_ReIndent)
Debug ComposeXML(1)
Else
Debug "Error: " + ErrorOutput$
EndIf
CloseLibrary(PBEx_MSSQL)
EndIf
System requirements:- Windows XP or higher
- .NET Framework 3.5 or higher
- Unicode activation (standard from PB 5.50)
Since the required. NET Framework is preinstalled by default from Windows 7 and can be installed on XP and Vista, this shouldn't be a problem to use this version.
No assembly registration with regasm.exe with administrator rights is necessary as with COMatePLUS.
Licence: This DLL file is free of charge and may be used both privately and commercially.
The following copyright texts must be provided:
Quote:
Copyright © 2019 RSBasic.de
Download: http://www.rsbasic.de/downloads/downloa ... _MSSQL.zip
I would be happy to receive feedback, suggestions for improvement, bug reports or requests. If you want to support me, you can also donate me a little something. Thank you
