Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 passing character from application to sproc

Author  Topic 

giovi2002
Starting Member

46 Posts

Posted - 2005-08-03 : 20:11:11
platform : access2003 adp / sql server
goal : pass a text value to procedure
How : Ado code

I've been trying to pass a text field to a sproc but it doesn't work.
Within a form i have a control, this value needs to be passed.
Within t-sql i defined @booktype varchar(50)
In my ado code
Dim strBooktype As String


And in the ado part
myado.Parameters.Append myado.CreateParameter("Booktype",adVarchar,50,adparaminput,StrBooktype)

My dateparameter passing is working except the varchar...why?
And why are the datatypes so difficult in compatibility between sqlserver and ado?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2005-08-03 : 20:40:25
myado.Parameters.Append myado.CreateParameter("@Booktype",adVarchar,50,adparaminput,StrBooktype)

You need to add the @ sign.

The datatypes aren't vastly different, and in any case there is a comparison table in most ADO documentation.
Do you know what version of ADO you're using? If you're using 2.5+, you don't need to explicitly declare your stored procedure parameters.

Tim
Go to Top of Page

giovi2002
Starting Member

46 Posts

Posted - 2005-08-04 : 08:14:37
quote:
Originally posted by timmy

myado.Parameters.Append myado.CreateParameter("@Booktype",adVarchar,50,adparaminput,StrBooktype)




Hi Tim, In ado parametrization you don't need the @, the @ is a sql server sign within t-sql.
For my dateparameters I'm not using @'s and they're working well.
Go to Top of Page

giovi2002
Starting Member

46 Posts

Posted - 2005-08-04 : 08:18:42
Timmy, I dont know which ADO version I'm using. I'm using access2003 and sql server 2000
Go to Top of Page

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2005-08-04 : 08:51:00
try using adChar instead of advarchar

myado.Parameters.Append myado.CreateParameter("Booktype",adchar,50,adparaminput,StrBooktype)

Kapil Arya
Go to Top of Page
   

- Advertisement -