Page 1 of 1 1
Topic Options
#35726 - 2003-01-28 12:18 AM DbGetRecordSet () Question
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Just wondering what the correct format for the connection string to a SQL 2000 server would look like?

THanks so much... also am I understanding correctly that dbgetrecordset() is the correct UDF if I wish to execute a stored procedure that returns records? I want those records back in an array... hope that made sense ; )

Thanks for the help..
_________________________
Austin Henderson

Top
#35727 - 2003-01-28 05:20 AM Re: DbGetRecordSet () Question
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Austin:

Please take a look at the UDF header for DBConnOpen() which contains example strings for the most common databases.

Also, DBGetRecordset() contains all info you need in order to execute stored procedures. Inside the code you will find a list of permitted values for database query types for the CMDTYPE parameter. Accordingly, the SQL parameter would then contain the name of the stored procedure.

Finally, according to the UDF header for DBGetRecordset() the UDF returns
quote:
2-D array of records or an empty string if the SQL query results in an empty recordset
_________________________
There are two types of vessels, submarines and targets.

Top
#35728 - 2003-01-29 05:45 PM Re: DbGetRecordSet () Question
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I am still having trouble...

Here is what I am doing..

code:
$DSN="DRIVER={SQL Server};SERVER=$Server;UID=m001kah;PWD=password;DATABASE=PSStartup"
$Statement2 = "exec ff_trips_sp2 'PEYCLE','S','01/20/03','01/20/03'"
;Open connection to DB or at least try... ; )
$OpenConn = DBConnOpen ("$DSN")
If @ERROR <> 0
If @ERROR = -2147352567
$LogLine = @TIME + " - unable to authenticate user $User" + @CRLF
$Write = WriteLine (1,"$LogLine")
$Silent = MessageBox ("Invalid SQL account information.","SMB ERROR : 200", 16)
Exit 200
Else
$LogLine = @TIME + " - general SQL error @ERROR detected." + @CRLF
$Write = WriteLine (1,"$LogLine")
$Silent = MessageBox ("General SQL error @ERROR detected.","SMB ERROR : 201", 16)
Exit 201
EndIf
EndIf

;Execute the stored procedure...
;=====================================================================
$LogLine = @TIME + " - calling stored procedure against db." + @CRLF
$Write = WriteLine (1,"$LogLine")

$ReturnArray = DBGetRecordSet($OpenConn,"$Statement2",4)
If @ERROR <> 0
$WRITEERROR = @ERROR
$WRITEERRORS = @SERROR
$LogLine = @TIME + " - error $WRITEERROR returned from sp." + @CRLF
$Write = WriteLine (1,"$LogLine")
$LogLine = @TIME + " - error $WRITEERRORS returned from sp." + @CRLF
$Write = WriteLine (1,"$LogLine")
$Silent = MessageBox ("Error $WRITEERROR in SP execution - contact admin.", "SMB ERROR : 210", 16)
Exit 210
EndIf

When I get to the part about executing the sp I get the following errors.

Error: -2147352567
SError: error COM exception error "Open" (Microsoft OLE DB Provider for ODBC Drivers - [Microsoft][ODBC SQL Server Driver]Syntax error or access violation) [-2147352567/80020009]

But when I log into QA with this account I have no problems running the sp. Any thoughts on what I am doing?

Thanks for the help thus far.
_________________________
Austin Henderson

Top
#35729 - 2003-01-29 06:02 PM Re: DbGetRecordSet () Question
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Are you using KiXtart 4.12+ ?

I never tested it with stored procedures. Does it work with a SP that does not require parameters? If there is a problem with SPs that include parameters then it'll take me a couple of weeks until I'll have time to look at it.

[ 29. January 2003, 18:10: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#35730 - 2003-01-29 06:07 PM Re: DbGetRecordSet () Question
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I am not sure.... I will try to look into it. The error seems to have something to do with BLOB fields...

Hmmm...
_________________________
Austin Henderson

Top
#35731 - 2003-01-29 06:09 PM Re: DbGetRecordSet () Question
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
KiXtart variables cannot contain more than 32000 characters! Also, they cannot contain the EOF character and the ASCII 0 character!
_________________________
There are two types of vessels, submarines and targets.

Top
#35732 - 2003-01-29 06:24 PM Re: DbGetRecordSet () Question
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
The field that the sp returns is only 2000 characters long. Shouldnt ba a problem. the other characters shounldnt be a prob either.

Thanks
_________________________
Austin Henderson

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 640 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.058 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org