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.
| Author |
Topic |
|
kensai
Posting Yak Master
172 Posts |
Posted - 2002-02-16 : 07:09:40
|
| Hi. I'm trying to try if my [url=http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=12882]problematic sp[/url] will work with Command. Since I don't know much about Command Object I'm just trying to do use some code I've found on this forum. But I'm having an error. Here's the code:set objRS = Server.CreateObject("ADODB.Recordset")Set objComm = Server.CreateObject("ADODB.Command")objComm.ActiveConnection = objRSobjComm.CommandText = "ptemp"objComm.CommandType = adCmdStoredProcobjComm.Parameters.Append objComm.CreateParameter("@isim", adVarChar, adParamInput, 50,"cmd1" )objComm.Parameters.Append objComm.CreateParameter("@a", adInteger, adParamOutput,3000)objComm.ExecutestrReturn = Trim(cmd.Parameters ("@a").Value) set objComm = Nothingset objRS = NothingThe error is:Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another./t/c.asp, line 19It's the ActiveConnection line. What should I do for this? |
|
|
kensai
Posting Yak Master
172 Posts |
Posted - 2002-02-16 : 07:16:55
|
| ok it works now :). I used this:objComm.ActiveConnection = "Provider=SQLOLEDB;Data Source=SERVER;Initial Catalog=table;User ID=user;Password=pass" |
 |
|
|
kensai
Posting Yak Master
172 Posts |
Posted - 2002-02-16 : 07:43:45
|
| Err, what should I use for text field type and size in CreateParameter method? |
 |
|
|
kensai
Posting Yak Master
172 Posts |
Posted - 2002-02-19 : 06:15:04
|
| uhm, any ideas? |
 |
|
|
jackstow
Posting Yak Master
160 Posts |
Posted - 2002-02-19 : 07:02:57
|
| Well, text and ntext datatypes don't seem to mix very well with Command object parameters. I had the same problem - http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=12651 - and there seem to be two solutions. Either select the text field into a recordset or datagrid using ADO/ADO.NET or split it up into several nvarchar fields.. The type for text in createparameter seems to be adVarChar, but you won't be able to use it as an output parameter..Jack |
 |
|
|
kensai
Posting Yak Master
172 Posts |
Posted - 2002-02-21 : 15:43:14
|
| oh I didn't knew that about text type. Thanks for pointing the topic. |
 |
|
|
|
|
|
|
|