Hi,
Can anyone please help me with an error I've got below? Thanks!
I'm trying to call a simple stored procedure using tedious and I have the following output:
State change: Connecting -> SentPrelogin
State change: SentPrelogin -> SentLogin7WithStandardLogin
Packet size changed from 4096 to 4096
State change: SentLogin7WithStandardLogin -> LoggedInSendingInitialSql
State change: LoggedInSendingInitialSql -> LoggedIn
SQL Connected!
C:\Projects\NodeJSDemo\NodeJSDemo\n
ode_modules\tedious\node_modules\babel-runtime\regenerator\runtime.js:493
throw exception;
^
TypeError: Cannot read property 'validate' of undefined
at Request.validateParameters (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\request.js:153:29)
at Connection.callProcedure (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\connection.js:1021:13)
at Connection.<anonymous> (C:\Projects\NodeJSDemo\NodeJSDemo\playerAdmin.js:50:24)
at Connection.emit (events.js:104:17)
at Connection.processedInitialSql (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\connection.js:916:17)
at Connection.STATE.LOGGED_IN_SENDING_INITIAL_SQL.events.message (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\connection.js:284:23)
at Connection.dispatchEvent (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\connection.js:781:59)
at MessageIO.<anonymous> (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\connection.js:713:22)
at MessageIO.emit (events.js:104:17)
at ReadablePacketStream.<anonymous> (C:\Projects\NodeJSDemo\NodeJSDemo\node_modules\tedious\lib\message-io.js:139:24)
The stored procedure si simple as this:
create procedure insertPlayer (
@id int,
@firstname varchar(50),
@lastname varchar(50),
@sport varchar(20)
)
as
begin
insert into tblPlayers (Id, FirstName, LastName, Sport)
values(@id, @firstname, @lastname, @sport)
end
The parameters are added to the request as below:
request.addParameter('id', TYPES.int, iId);
request.addParameter('firstname', TYPES.VarChar, sFirst, { length: 50 });
request.addParameter('lastname', TYPES.VarChar, sLast, { length: 50 });
request.addParameter('sport', TYPES.VarChar, sSport, { length: 20 });
Kind regards,