Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error '3708' Parameter object was inproperly defined.

Status
Not open for further replies.

Rahel

Programmer
Feb 16, 2000
30
GB
I am trying to pass a simple parameter to a stored procedure from vb6 and recieve the above error.

heres the vb bit:

Private Sub Command1_Click()
Dim cnn As Connection
Dim rst As Recordset
Dim Command1 As Command

' Instantiate the object variables
Set cnn = New Connection
Set Command1 = New Command
Set rst = New Recordset

' Establish a connection to the database
With cnn
.Provider = "SQLOLEDB"
.ConnectionString = "server=xxxxx;uid=sa;pwd=;database=dreamtec"
.Open
End With

' Create the Command object
With Command1
.CommandType = adCmdStoredProc

' set the name of the stored procedure
.CommandText = "spprojectcode"

' create and append the input parameter
.Parameters.Append Command1.CreateParameter("projectcode", adChar)

' set the initial value of the parameter
.Parameters("projectcode").Value = Text1.Text

' set the connection
.ActiveConnection = cnn
End With

' call the stored proc and save the results in a recordset
Set rst = Command1.Execute
End Sub

and heres the SQL Server sp:

CREATE PROCEDURE spProjectCode @ProjectCode char (10) AS
select * from tblmeeting
where ProjectCode=@ProjectCode

I have an identical procedure which works fine when the parameter is an int for the sp .... why does it not work when passing a text parameter?

Can someone point me in the direction of what I am doing wrong?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top