Using AppendChunk on a parameter?

ADO

    Next

  • 1. Does anuone know HOW to get Stored procedure text via ADOX ?
    Does anuone know HOW to get Stored procedure text via ADOX ? I use this construction: Private u As ADOX.Catalog Set u = New ADOX.Catalog u.ActiveConnection = DatabaseConnection Dim cmd As New ADODB.Command Set cmd = u.Procedures.Item( 1 ).Command <--------- This line flames : "Interface is not implemented!" txtProcedureText.Text = cmd.CommandText What am I doing wrong? What is a way to obtain Stored procedure text if this way is absolutely wrong? Thanks a lot! Gnum
  • 2. Cannot create ADO Command Object from ASP
    Has anyone run into this problem? An ASP page creates a command object that calls a stored procedure. This was working one day; next, it stopped. I am not in control of the various patches that get applied to this machine, so yes, it is possible that new MS code was applied to it. The error is a 429, 'Cannot create ActiveX Component'. I can get the code to work if I turn on the IE option 'Initialize and script ActiveX controls not marked as safe.' For various reasons, I don't wish to use this 'fix'. I can call the stored procedure in a .vbs file (run as a non-interactive job) and it works successfully. Yes, I've tried technet. If anyone has information, I'd appreciate it. Thanks.
  • 3. ADO 2.53 XML Stream
    I'm using ASP and ADO 2.53 to retrieve an XML stream from a SQL Server stored procedure that uses FOR XML EXPLICIT. I have the following code below, but I get a message stating that "Item cannot be found in the collection corresponding to the requested name or ordinal." I haven't had any luck in finding a solution through the various code libraries and code guru sites. Any help is greatly appreciated! Dim dbConn, oCMD, oStream, sXML Set dbConn = Server.CreateObject("ADODB.Connection") dbConn.Open "DSN=myDB;UID=myUser;Pwd=myPWD" Set oCMD = Server.CreateObject("ADODB.Command") Set oStream = Server.CreateObject("ADODB.Stream") oStream.Open With oCMD .CommandText = "myProc" .CommandType = adCmdStoredProc .ActiveConnection = dbConn .Properties("Output Stream") = oStream .Execute , , adExecuteStream End With sXML = oStream.ReadText Set oCMD = Nothing Set oStream = Nothing dbConn.Close: Set dbConn = Nothing
  • 4. any issues with mdac 2.8?
    has anyone done a largish install of mdac 2.8 on multiple os, multiple servers, apps, etc. (custom & commercial) any issues?
  • 5. eof/bof Problem
    Hi My Problem is that when I execute a query " select * from names where firstname='john' ", and if there are no such records which have first name as 'john' then ,I get an error message, I would Like to have the asp code that returns a message like " No such Records" Thank You Praveen

Using AppendChunk on a parameter?

Postby Jiho Han » Sat, 25 Oct 2003 06:55:04 GMT

I am trying to insert a new record using the Command object and one of the
parameters is a adLongParam type (text).

Executing the Command object fails saying that the parameter is incorrect.
Is it only usable on an existing record?

If someone has a sample code for AppendChunk on a Parameter object and would
like to share it, I'd much appreciate it.
Thanks in advance.

Jiho Han
Infinity Info Systems Corp.



Re: Using AppendChunk on a parameter?

Postby Val Mazur » Sat, 25 Oct 2003 12:08:00 GMT

Hi,

As I know there is no adLongParam type of parameter and you should use
adLongVarChar instead. After you declare your parameter all you need to do
is to assign actual string to the Value property of it. Could you post your
code here?

-- 
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
 http://www.**--****.com/ 






would



Re: Using AppendChunk on a parameter?

Postby Paul Clement » Sat, 25 Oct 2003 22:35:44 GMT



I am trying to insert a new record using the Command object and one of the
parameters is a adLongParam type (text).

Executing the Command object fails saying that the parameter is incorrect.
Is it only usable on an existing record?

If someone has a sample code for AppendChunk on a Parameter object and would
like to share it, I'd much appreciate it.
Thanks in advance.

You may want to indicate what kind of database you are using.


Paul ~~~  XXXX@XXXXX.COM 
Microsoft MVP (Visual Basic)

Re: Using AppendChunk on a parameter?

Postby Jiho Han » Wed, 29 Oct 2003 01:36:00 GMT

adLongParam refers to a parameter attribute and it is one of the
requirements for AppendChunk method.  I apologize if that wasn't clear.  A
parameter of type adLongVarChar indeed has this attribute set.  I've tried
simply setting the value property but it fails and that is why I thought
that it was necessary to use AppendChunk method.  I wonder if it is a
shortcoming of the provider that I am using.  Of course you're more than
welcome to critique the following excerpt:

Set objCmd = CreateObject("ADODB.Command")
If m_Connection.State = adStateClosed Then
    m_Connection.Open
End If

With objCmd
    .ActiveConnection = m_Connection
    .CommandType = adCmdText
    .CommandText = "INSERT INTO HISTORY (HISTORYID, LONGNOTES) VALUES (?,
?)"
    For i = 0 To UBound(arrFields)
        If (.Parameters(i).Attributes And adParamLong) = adParamLong Then
            .Parameters(i).AppendChunk arrFields(i)
        Else
            .Parameters(i) = m_Fields.Item(arrFields(i))
        End If
    Next
    .Execute
End With

UPDATE:
I found out instead of using the provider-provided parameter information
(via .Parameters(i)), manually constructing the parameters via
.CreateParameter coupled with .Parameters.Append solves the issue.  For some
reason, even though, the provider-returned information seems to be
identical, it does not like it when I actually use it to insert/update.
Note that I am able to use the Value property as you suggested this way.

So, I am wondering, when do you use AppendChunk on a parameter?  For a
binary data?(image perhaps?)






your



the
incorrect.



Re: Using AppendChunk on a parameter?

Postby Val Mazur » Wed, 29 Oct 2003 11:26:09 GMT

i Jiho,

I would not rely on a provided information about parameters and declare them
explicitly. In that case your code will have reliable information for the
parameters.

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp


"Jiho Han" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
some
do




Return to ADO

 

Who is online

Users browsing this forum: No registered users and 7 guest