Hi Gvee, thanks for the reply.
Arh, i am trying to run the following, and i think i've done it correctly, but clearly there is a problem so something is wrong:
Code:
str = "EXEC spNewStarter '" & formName & "','" & formSurname & "','" & formStore & "'," & formHours & ",'" & formUniform & "','" & formSex & "','" & formNI & "'"
CON.Execute(str)
The only "int" in the above is: formHours, so no single quotes, but...
...All others are varchars, and so have the single quote around them. formNI, is used for a users' National Insurance number. And as you have said 1 is still text, but it has the single quotes.
this is the sproc
Code:
ALTER PROCEDURE [dbo].[spNewStarter]
(
@formNI VARCHAR(20)
,@formName VARCHAR(30)
,@formSurname VARCHAR(30)
,@formStore VARCHAR(4)
,@formHours INT
,@formUniform VARCHAR(4)
,@formSex VARCHAR(1)
)
AS
INSERT INTO [knowledge].[dbo].[NewStarter] (
NI
,Name
,Surname
,Store
,Hours
,UniformSize
,Sex
)
VALUES (
@formNI
,@formName
,@formSurname
,@formStore
,@formHours
,@formUniform
,@formSex
)
It all seems to match, but clearly im missing something.?

I think im being a dougnut, they got to be in the same order? it cant be that simple right? will try it now and check back.
Regards
MG
Quote:
Originally Posted by gvee
The error is being thrown by SQL where it expects an integer and you're passing it some text.
Remember: '1' is still text (note the quotes!)
|