SQL connection

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DiscoStu
Posts: 11
Joined: 16 Mar 2016, 20:11

SQL connection

11 Oct 2016, 20:35

I'm trying to setup an SQL connection to a server using ADOSQL (https://autohotkey.com/boards/viewtopic.php?t=74), but keep getting errors. Anyone spot where I'm going wrong, or suggest a better way to make the connections?

Note the findStudyID string is being used for testing.

Thanks in advance!

Code: Select all

#include ADOSQL.ahk

connectString :="Provider=SQLOLEDB.1;Password=abc.Abc;Persist Security Info=True;User ID=sa;Initial Catalog=NEXUS_SERVERNAME;Data Source=SERVERNAME;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False"

findStudyID = `{C6CF91C0-05FA-471C-BC15-BBD79689B20A`}

query_test =
	(
	SELECT * FROM dbo_SleepReportSleep Where studyID=%findStudyID%
	)
objResult := ADOSQL(connectString, query_test)
	msgbox, %ADOSQL_LastError%
	msgbox % objResult.MaxIndex() " rows returned"
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: SQL connection

12 Oct 2016, 02:55

I don't know whether it's the (only) issue, but I'm pretty sure your SQL query is invalid. Try adding quote marks around the GUID value in the SQL query (and maybe remove the braces).
User avatar
Jovannb
Posts: 268
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: SQL connection

12 Oct 2016, 09:07

Hi

here a working example:

Code: Select all

#singleinstance force
#Include adosql.ahk

rs:= object()

connection_string =
( ltrim join;
Provider=Microsoft.ACE.OLEDB.12.0
Data Source=xxx_adressen.accdb 
User Id=yyyy
Password=
)

sql_query := "(DELETE * FROM Adressen WHERE ID = " SQL_datensatz_ID ")"

rs:=ADOSQL( connection_string, sql_query ) ;

return
# "Adressen" the name of the Table

# "SQL_datensatz_ID" a variable

regards

J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
malik_ajay5
Posts: 7
Joined: 17 Sep 2017, 10:55

Re: SQL connection

17 Sep 2017, 11:50

its not working please explain me

Data Source=xxx_adressen.accdb
User Id=yyyy
and what i need to install to connection with sql server server name is LAPTOP-DK3PDTSG\SQLEXPRESS
User avatar
Jovannb
Posts: 268
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: SQL connection

18 Sep 2017, 00:09

Hi,

for your particular connection you need to define:

# Provider .. it depends which SQL-Server release/type you use, have a look at google finding your provider-definition

# Data Source .. where to find your SQL-Server IP-Address or Server-Name

# User ID .. your user name which has access on that SQL-Server

# Password .. if one is defined on SQL-Server you have to set it here

regards

J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
malik_ajay5
Posts: 7
Joined: 17 Sep 2017, 10:55

Re: SQL connection

22 Sep 2017, 02:22

Thanks I got the answer,
I am very Thank-full to you for answering
appreciating your responce
malik_ajay5
Posts: 7
Joined: 17 Sep 2017, 10:55

Re: SQL connection

22 Sep 2017, 02:25

Hi my Query Is............


I Want to add all data in every field of my web form from .pdf file and update the web form please help me out
malik_ajay5
Posts: 7
Joined: 17 Sep 2017, 10:55

Re: SQL connection

22 Sep 2017, 02:27

hi

i have a pdf file and i want to add data from .pdf file to my web form .please suggest me any solution. please please

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo and 225 guests