Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




ADO Commands And Return Values


Hi,

I have a SQL 2000 stored procedure that is currently used by some other stored procedures, so I don't really want to change the stored procedure too much, but I would like to get the identity field. I notice in VB that one of the directions for parameters is adParamReturnValue, so I figured that this retrieved the value from the RETURN statement of the stored procedure.

I have either done this wrong, or am totally wrong in my thinking, can any one help here please?

Stored Procedure:


Code:


Create Procedure spInsertJobPgmCalled
@JobIdInt,
@ProgramNameVarChar(10)

As

Declare @PgmId Int
Declare @JobProgramIdInt

Select @PgmId = ProgramID
From Programs
Where UPPER(ProgramName) = UPPER(RTrim(@ProgramName));

Insert Into PgmCalled
(JobId, PgmId)
Values (@JobId, @PgmId)

Set @JobProgramId = Ident_Current('PgmCalled')

Return @JobProgramId

Go


My VB Code:


Code:


Sub InsertProgramCalled()

Dim adcCmd As New ADODB.Command

On Error GoTo InsertProgramCalled_Error

If lJP_JobId = 0 Then
RaiseEvent InformationMissing("JobId")
Exit Sub
End If

If sProgramName = "" Then
RaiseEvent InformationMissing("Program Name")
Exit Sub
End If

With adcCmd
.CommandText = "spInsertJobPgmCalled"
.CommandType = adCmdStoredProc
.ActiveConnection = objDB.DbConnection
.Prepared = True
.Parameters.Append .CreateParameter("JobId", adInteger, adParamInput)
.Parameters.Append .CreateParameter("ProgramName", adVarChar, adParamInput, 10)
.Parameters.Append .CreateParameter("JobProgramId", adInteger, adParamReturnValue)

.Parameters.Item("JobId") = lJP_JobId
.Parameters.Item("ProgramName") = sProgramName

.Execute

lJobProgramId = .Parameters.Item("JobProgramId")
RaiseEvent JobProgramInserted(lJobProgramId)
End With

Exit Sub

InsertProgramCalled_Error:
RaiseEvent UpdateFailed(objDB.AdoError)

End Sub


I get an error on the .Execure statement, with "Too many arguments specified". Can anyone tell me how to retrieve the value contained in the Return statement?

Thanks,




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
ADO Commands And Return Values
Hi,

I have a SQL 2000 stored procedure that is currently used by some other stored procedures, so I don't really want to change the stored procedure too much, but I would like to get the identity field. I notice in VB that one of the directions for parameters is adParamReturnValue, so I figured that this retrieved the value from the RETURN statement of the stored procedure.

I have either done this wrong, or am totally wrong in my thinking, can any one help here please?

Stored Procedure:

Code:
Create Procedure spInsertJobPgmCalled
@JobIdInt,
@ProgramNameVarChar(10)

As

Declare @PgmId Int
Declare @JobProgramIdInt

Select @PgmId = ProgramID
From Programs
Where UPPER(ProgramName) = UPPER(RTrim(@ProgramName));

Insert Into PgmCalled
(JobId, PgmId)
Values (@JobId, @PgmId)

Set @JobProgramId = Ident_Current('PgmCalled')

Return @JobProgramId

Go


My VB Code:

Code:
Sub InsertProgramCalled()

Dim adcCmd As New ADODB.Command

On Error GoTo InsertProgramCalled_Error

If lJP_JobId = 0 Then
RaiseEvent InformationMissing("JobId")
Exit Sub
End If

If sProgramName = "" Then
RaiseEvent InformationMissing("Program Name")
Exit Sub
End If

With adcCmd
.CommandText = "spInsertJobPgmCalled"
.CommandType = adCmdStoredProc
.ActiveConnection = objDB.DbConnection
.Prepared = True
.Parameters.Append .CreateParameter("JobId", adInteger, adParamInput)
.Parameters.Append .CreateParameter("ProgramName", adVarChar, adParamInput, 10)
.Parameters.Append .CreateParameter("JobProgramId", adInteger, adParamReturnValue)

.Parameters.Item("JobId") = lJP_JobId
.Parameters.Item("ProgramName") = sProgramName

.Execute

lJobProgramId = .Parameters.Item("JobProgramId")
RaiseEvent JobProgramInserted(lJobProgramId)
End With

Exit Sub

InsertProgramCalled_Error:
RaiseEvent UpdateFailed(objDB.AdoError)

End Sub


I get an error on the .Execure statement, with "Too many arguments specified". Can anyone tell me how to retrieve the value contained in the Return statement?

Thanks,

Return Values
I want to call my function in this format


Code:
UID = MyFunction()

Is there a way to make my function give a return value in this way?

DOS Return Values?
Hi All;

I am trying to send a command to the DOS prompt and return whether it was successful. For instance; pinging a host to see if there is network connectivity and returning a value or string that i can test ... is this possible? i know that:

x = shell("ping ####")

will return the PID but nothing else..

any help is appreciated..

j

Return Values
I have a form in which I click a search button to bring up a datagrid to select a member, I need to take the highlighted member record in the datagrid and return MemberName, MemberSSN to the orginal form.

Return Two Values
this has certainly been asked a 1000 times at least but i must be stupid since i can't find it here.

i'd like a function that returns two values, basically for error handling, something like:

VB Code:
Function DoSomething(inputString As String) As String, Integer On Error GoTo ErrHandle 'do the function here Exit Function ErrHandle:    DoSomething1 = Err.Description    DoSomething2 = Err.Number End Function

you see the point. what is the best way to do so...?

thank you...

wc.

DOS Return Values??
Hi All;

I am trying to send a command to the DOS prompt and return whether it was successful. For instance; pinging a host to see if there is network connectivity and returning a value or string that i can test ... is this possible? i know that:

x = shell("ping ####")

will return the PID but nothing else..

any help is appreciated..

VB Return Values
Hi,
Does anyone know if it is possible to pass a return value to the calling application from a VB EXE shelled by a VC++ or VBScript application

Return Values From VB
Hai,

Could anyone help me out with the following questions?

1) How do u make a function or procedure to return more than one value
2) I want to add more than two nos using a function. How do u pass the parameters
3) detailed difference between ActiveX EXE and ActiveX DLL. When both are COM based, why microsoft have introduced two concepts.
4) What is the difference between Windows regular dll and ActiveX dll.

5) Is it possible to develop a DLL which works as both ACTIVEX DLL and Windows regular DLL? (ANY Windows Based Language).

6) What is OCX (Please compare with ActiveX DLL and ActiveX EXE) Which is Automation Server here( OCX or ActiveX executables)

7) What is Plugin? (Such as JRE, Flash) How IE reacts when we try to open applet or Flash file?

8) What is the difference between normal EXE and all above executables in terms of memory management?

Thank you,

Regards,
K. Sripriya

How Do U Get Return Values From Functions?
i wanted to know how you can get a return value from a function, as when i have done it, made the function name equal a value, it keeps saying that it cannot be a variable.

any help is really appreciated.

Return Values For Err.LastDLLError?
Hi everyone,

does anyone know all possible return values (and its associated error description) for err.LastDLLError?

thanks buds

Getting At Function Return Values
Can I get a function to return multiple values?

If I write:

Dim myAgentID as Long
myAgentID = mFullAppDlg.ReturnAgentID(myAgentID)

And, in the class file that has the function it looks like:

Public Function ReturnAgentID(ByRef AgentID As Long) As Boolean
AgentID = 1234
End Function

How do I get at the value of AgentID?

myAgentID is returning the boolean.

Cheers

Return Values For Err.LastDLLError?
Hi everyone,

does anyone know all possible return values (and its associated error description) for err.LastDLLError?

thanks buds

Return Values From Boolean
Hi,

Is there any builtin function which will give value 1 for True and value 0 to false. I have following function:
VB Code:
Private Function BoolToVal(ByVal blnTemp As Boolean) As Integer'This function will return 1 if the value is true else will return 0    If blnTemp = True Then        BoolToVal = 1    Else        BoolToVal = 0    End IfEnd Function

Return Values From Website
Hello everybody i am new here. i was wondering if anybody could help me with an issue i have got. Here it is.
I have a program that allows you to select an option from a list, say 'Audio' and then press a 'Search' button. This will return all of the applications that are to do with audio. But what i am stuck on is how to get a database of all of the audio applications in the first place from the website. I would like it to return the titles to begin with. Thats all. I hope somebody can help. Thankyou

Can A Function Return Two Values
I want to create a function that will recieve 1, sometimes 2 values. That part I know how to do.

However, I'm not sure if it's possible for a function to return 2 values without calling the function twice.

If I send one string to a function I want it to return one string, if I send it two I'd like it to return two...how can I do this?

Not Require Return Values
If I have a function that returns a value I don't care about, how can I make VB6 not complain about not catching that answer? I have done it before, so I know it is possible, but I forget how. Right now when I click off the line, it turns red and an error comes up "Compiler Error: Expected ="

How Do I Return Multiple Values?
I tried making a function that took 4 varibles ByRef in hopes that function could change them and when the function ended the new values would be back in the caller function. Like a reference should, right?

Is there anyway to get this done?

Thanks,
NOMAD

Function Which Can Return 2 Values ??
is there any possibility in vb to write a function which can return 2 values ???
is that possible ???
,,,,
senthil

Return Values Of Function
Hi,

What i want to achieve is the following:

I have written a function and it returns as boolean.

But in case of a "false" value i also want to return a string and in case of a "true" value i do not want to return a string.

How should i do this?

Thanx in advance

Michiel

How To Return Array Values///
hello,


how to return array values from a function
for ex...

Sub ByteCopy(oldCopy() As Byte, newCopy() As Byte)
Dim i As Integer
ReDim newCopy (Lbound(oldCopy) To UBound(oldCopy)

For i Lbound(oldCopy) To Ubound(oldCopy)
newCopy(i) = oldCopy(i)
Next
End Sub

in the commandclick event
how to call the above function
i tried like this but it was vain

dim r() as byte
r()=bytecopy(oldcopy as byte,newcopy as byte)as byte()
showing some error
how to call above function

Application Return Values
I got two application. Application A is a menu program which calls the application B by using shell command. Application B is a standard vb.exe file.

My question is how can I return an integer value from application B to A when program B ends itself? Application B should return different integer values depending upon performed tasks.

Here is an example in C or C++
void main()
{
/* perform some tasks
return 0;
}

0 is returned to the operating system or calling program.

Is there a way to apply this functionality in visual basic?

Return Values From A Php Script...
Hi,
i have made a little program to grab data from a php script...
my php script outputs something like.....

Value1|Value2|Value3 etc etc

Is there an easy way to open the connection to the php script... read the data and run like a loop over the values to do something with each?

like store it as a variable or output to a multiline textfield.

help appreciated
Rob

Datagrid Return Values
I am using a datagrid to produce a form containing all rows in a table that satisfied a search.
I want to click on the row desired, return, and produce a form with all the data about that particular row.

I can click on all the rows from #2 on down and get the desired values....
but when i click on row#1, i get back null values...

i use the colrowchange event to select the values from the columns....
why not row number 1??????

Can A Function Return Two Values?
Can a function return two values? If so how?

_______________________________________________________________________________

"What, you may ask, the hell am I talking about." (Douglas Adams)

Values Return To Default
I've just started trying to make an ActiveX control. I decided it would be useful to make a control to create hexadecimal colour values. Basically, there are three text boxes (corresponding to red, green and blue) each of which has a vertical scroll bar. Each of the text boxes has a two digit hexadecimal value which is altered by its scrollbar. The resulting colour mixture is displayed in a picture box.

There are properties for each of the colours which can have a value between 0 and 255. There's another property that returns the colour as a hexadecimal, and one that returns it as a colour. I also have a property to change the caption of a frame in the control.

The problem is, each time I run the programme, the properties revert to default, despite the fact that I changed them at design time. I also get errors when I add the control to a project, though it still runs.

Any ideas what this could be?

Runas Return Values
Does anyone know the return values for the runas command?

Function Which Return Several Values ...
Hi,

I would to create a function which returns 3 integers. I tried with an array and pointer (I know a function can returns only 1 thing) ... but I didn't succeed ...
Thanks to answer me ...

Rody

Can A Public Sub Return 2 Values?
I want to have a Class in Access. It has a Sub (Public, I guess) that will calculate the width & height of an image. The sub works. I think I need two Public properties for width and height, here's one of them:
Code:
Private mWidth As Long
Public Property Get ImgWidth() As Long
    ImgWidth = mWidth
End Property

Here is my mocked-up Sub
Code:
Public Sub GetWandH()
    mWidth = 200
End Sub

But when i go to use it, VBA complains that it expects a Function or variable.
Code:
Sub testgw()
Dim lngW As Long
Dim imgclas As New clsImageDims
lngW = imgclas.GetWandH
End Sub

So, do I have to use a Function, and if so canit return two values, width & height?

------------------------------------------------------------------------------------------------
Put your PC to good work at vbCity at world community grid and join Team vbCity.
2,669,763 3,325,308 points and ranked 1,195 1,149 as of March 8 May 23, 2008!
------------------------------------------------------------------------------------------------

Edited by - Geof on 9/13/2007 3:28:27 PM

Form Return Values
I'd like to build up a form with 'ok' and 'exit' button, returning vbOk or vbExit respectively when I unload it, as I do with msgbox function. How can I do it?
Thanks, Faggio

Addressbook Return Values
I am using VB5 and MAPI controls to send messages. I have a simple form that contains a subject, textbody, CC, and send.
I want to open the addresssbook upon selecting CC. I can do this with ease. However, I want to return the address of whomever I select to the CC field in my form but so far cannot manage this. Is this possible?

Please help.
Zabo.

Return Calculated Values From Function
How can I call a function that calculates some string values into an array, and pass them back to their original place? No Return like in VB.NET...


Code:
' xx(cc) format is "QtyParts,PartNo,PartDesc,TestEquip"
For c = 0 To rcC
Debug.Print ("xx(c): " & xx(c))
Explode4 (xx(c))

rsS.AddNew
rs.Fields("ID") = nextidS + c
rs.Fields("RDetIDRef") = riR
rs.Fields("QtyParts") = yy(0)
rs.Fields("PartNo") = yy(1)
rs.Fields("PartDesc") = yy(2)
rs.Fields("TestEquip") = yy(3)
rsS.Update

Next c

skipSF2:
rsS.Close
Set rsS = Nothing

Me.Refresh
Me.AllowAdditions = False

End Sub

Private Function Explode4(CSVString)
On Error GoTo StopFunction

' Separate (4) text comma delimited text strings
Dim yy(3) As String
Dim c As Integer
Dim tmpPos As Integer
Dim tmpString As String
tmpString = CSVString
For c = 0 To 3
tmpPos = InStr(tmpString, ",")
If c = 3 Then
yy(c) = tmpString

Else
yy(c) = Left(tmpString, (tmpPos - 1))

End If
Debug.Print ("yy(c): " & yy(c))
tmpString = Mid(tmpString, (tmpPos + 1), Len(tmpString))

Next c

StopFunction:
Exit Function

End Function

Functions/Subs With Return Values...
I assume that there is SOME way to have a return value assigned to a function/sub, but how about a string? The reason why I am wondering this is to simplify my encryption technique to one line of code (outside the sub). Its probably something stupidly simple, but I have been unable to find anything on google on it

Function To Return Values Into An Array?
Public Function Makethisintoarray(Intext As String) As String
Makethisintoarray(0) = "1"
Makethisintoarray(1) = "2"
Makethisintoarray(2) = "3"
End Function


Is this kind of think possible?

How would I call the values?

Script Control & Return Values
How can you get return values from code executed with a script control?
i.e If you executed an Input command from a scriptcontrol, how would you get the input?

Comparing Data Via Sql To Return Values
I have a database with a contact info table and a appointments info table. What I want to do is have the user type in either a single date or a range of dates and be able to view all appointments for those values.

I guess my first problem is getting the data control to return exactly what I want.


Code:
Private Sub cmdGenerate_Click()
Dim StartDate As String
StartDate = mskSingleDate.Text
StartDate = DateValue(StartDate)
Dim strSQL As String
strSQL = "SELECT EventName, StartDate, StartTime, Description FROM Contacts " & _
"INNER JOIN Appointments ON Appointments.ContactID " & _
"= Contacts.ContactID WHERE Appointments.StartDate = " & StartDate
datReportData.RecordSource = strSQL
datReportData.Refresh
End Sub
How can I get the dates to work together? Weird thing is that If I replace the = at the end of the sql statement with a >, it returns all appointments. Any thoughts?

Need better, clearer info to help?

Get The Return Values - Store Procedure
Hi, I meet a problem when I am using the store procedure in SQL server 7.
If I want to passing the table name, and data into a sp. and let the sp to check whether the data oledi exist in the table or not. If it is exist, I want to return the data created Date, a fields in the table. If not exist, it will insert the data into the table. I meet the problem in return the data created date, because the table name is a parameter value. I only can use EXECUTE(strSql) to run the select statement but unable to read the value into a variable. Do you have any solution to solve this problem?

[MS ACCESS] Return Values (forms)
Hello,

I got a procedure (P) on my main form (A) which opens a form (B), on which the user fills in some textfields. When the user clicks "OK", I validate these fields in a procedure (O) on form (B) and then I wanna return a value to the procedure (P) on my main form (A) and execute the rest of the code in the procedure (P).
How can I do this without using module-level variables?

I hope I explained myself wel

thanx in advance,

Johny

Edit: This thread needs to be moved to Office development forum, I missed

ThunderVB ASM And Function Return Values
Anyone can give a simple sample code that is changes a function return value? I can work with subs, but being able to work with functions would be handy as well.

String Functions Return Values.
My question is why do string functions like Trim and Left return variants by default? Variants are inefficient.

You have to use Trim$(...) or Lef$(...) to get it to return strings.

I can't think of an instance where TRIM returning variant will help.

So I'm wondering why the default return value is variant.

Return Multiple Values From Function
I have created a function that takes a date as its argument and I want it to return 3 values (month, Quarter, Financial Year).

The code itself works fine (I have tested it using msgboxes) However I need to actually return all 3 values, and I cannot see how to do this with a simple function.

Do I need to use Property Let/Get, or a class?

Thanks

Francis

Stored Proc To Return Values In VB
Hi

I need help creating my very first stored proc - can anyone assists
me??? also I want to use the result in my vb app....


VB Code:
SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GO  CREATE PROCEDURE [dbo].[GETPACKERID1]  @lastname char output,@badge char output  as declare @ibadge int select Badge as ibadge from OPERATOR where badge like @ibadge  Go--------------------------------------------------------------------------------


how do I place in vb



Thanks

Return Values To The Command Line
Hello there:

I am new with VB, and I wonder if somebody out there could help. I am trying to return a value from a VB program to the DOS command line (as it is done in C). Is that possible using VB? If it is, how?

Thanks in advance,

Manuel

Return Multiple Values From A Function?
Can you return multiple values from a function? and if so how? can you return an array?


THANKS FOR YOUR HELP AGAIN GUYS!

RegQueryValueEx - How Do I Make It Return Values?
Well this is what I tried, the part that troubles me is enframed by ...


VB Code:
Option Explicit  'FUNKTIONENPrivate Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As LongPrivate Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As LongPrivate Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As LongPrivate Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As LongPrivate Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As LongPrivate Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As LongPrivate Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As LongPrivate Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long 'KONSTANTENPrivate Const ERROR_SUCCESS = 0& Private Const HKEY_CLASSES_ROOT = &H80000000Private Const HKEY_CURRENT_CONFIG = &H80000005Private Const HKEY_CURRENT_USER = &H80000001Private Const HKEY_DYN_DATA = &H80000006Private Const HKEY_LOCAL_MACHINE = &H80000002Private Const HKEY_PERFORMANCE_DATA = &H80000004Private Const HKEY_USERS = &H80000003 Private Const SYNCHRONIZE = &H100000Private Const KEY_CREATE_LINK = &H20Private Const KEY_NOTIFY = &H10Private Const KEY_ENUMERATE_SUB_KEYS = &H8Private Const KEY_CREATE_SUB_KEY = &H4Private Const KEY_SET_VALUE = &H2Private Const KEY_QUERY_VALUE = &H1Private Const STANDARD_RIGHTS_ALL = &H1F0000Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))  'TYPEN'CreateExPrivate Type SECURITY_ATTRIBUTES    nLength As Long    lpSecurityDescriptor As Long    bInheritHandle As LongEnd Type'EnumKeyExPrivate Type FILETIME  dwLowDateTime     As Long  dwHighDateTime    As LongEnd Type   Sub RegRunLesen() Dim strKeyFolder As StringDim lngKeyHandle As LongDim strValName() As StringDim lngValType() As LongDim bytValData As ByteDim lngLpcData As LongDim intBound As IntegerDim fltTime As FILETIMEDim str As StringDim lngRet As LongDim lngLpcVal As LongDim strValue() As String strKeyFolder = "SoftwareMicrosoftWindowsCurrentVersionRun"'strKeyFolder = ""lngKeyHandle = F_OpenKeyLM(HKEY_LOCAL_MACHINE, strKeyFolder) intBound = 0Do    ReDim Preserve strValName(intBound)        ReDim lngValType(intBound)     strValName(intBound) = String(255, 0)           If lngRet = RegEnumKeyEx(lngKeyHandle, intBound, strValName(intBound), 255, 0, 0, 0, fltTime) = ERROR_SUCCESS Then        Debug.Print "enumKey error or end"        Exit Do    Else        Debug.Print strValName(intBound)    End If    intBound = intBound + 1Loop intBound = 0Do    ReDim Preserve strValName(intBound)    ReDim Preserve strValue(intBound)                strValName(intBound) = String(255, 0)    strValue(intBound) = String(255, 0)        lngLpcData = 255    lngLpcVal = Len(strValValue(intBound))    If lngRet = RegEnumValue(lngKeyHandle, intBound, strValName(intBound), lngLpcData, 0, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then               Debug.Print "enumValue error or end"        Exit Do    Else                'strValName(intBound) = Left(strValName(intBound), InStr(1, strValName(intBound), Chr$(0)) - 1)        strValName(intBound) = Left(strValName(intBound), lngLpcData) & "0"        lngLpcData = 255' :( :( :( this won't return anything - maybe something wrong in the 2 or 3 lines above? :( :( :(If RegQueryValueEx(lngKeyHandle, strValName(intBound), 0, ByVal 0&, strValue(intBound), lngLpcData) <> ERROR_SUCCESS Then            Debug.Print strValName(intBound)            Debug.Print strValue(intBound)' :( :( :(        Else            Debug.Print "queryValue error"        End If    End If    intBound = intBound + 1Loop Debug.Print "ende" End Sub Function F_OpenKeyLM(lngBaseFolder As Long, strKeyFolder As String) As Long Dim lngKeyHandle As LongDim lngRet As Long lngRet = RegOpenKeyEx(lngBaseFolder, strKeyFolder, 0, KEY_ALL_ACCESS, lngKeyHandle) If lngRet = ERROR_SUCCESS Then    RegOpenKeyEx lngBaseFolder, strKeyFolder, 0, KEY_ALL_ACCESS, lngKeyHandleElse    Debug.Print "error opening key"End If F_OpenKeyLM = lngKeyHandle End Function


thx,

Helger

Return Values From Stored Procedure
I HAVE A STORED PROCEDURE ON SQL SERVER WITH AN OUTPUT PARAMETER.
MY VB PROGRAM IS NOT PICKING UP THE CORRECT VALUE OF THE OUTPUT PARAMETER. MY RETURN VALUE IS ALWAYS "0". IF I PUT A PRINT STATEMENT FOR THE RETURN VALUE AS MY LAST LINE IN THE STORED PROC IT PRINTS THE CORRECT RETURN VALUE WHICH IS A STRING MESSAGE.
HERE IS MY VB CODE:

Dim objCmd As ADODB.Command

' I ALREADY HAVE AN OPEN CONNECTION TO SQL SERVER AT THIS POINT


Set objCmd = New ADODB.Command

'Set the command object properties
Set objCmd.ActiveConnection = g_objConn
objCmd.CommandText = "dbo.up_phadd"
objCmd.CommandType = adCmdStoredProc

'Append the parameters
objCmd.Parameters.Append objCmd.CreateParameter("MESSAGE", adVARCHAR, adParamOutput, 100)


'Execute the command object
objCmd.Execute


MsgBox "MESSAGE IS : " & OBJCMD("MESSAGE")

Default Function Return Values
Does a function whose return vale is "AS long" return a default value of 0.
Im debugging a VBscript that has'nt set the return value (It named the variable wrongly)
Thanks Folks
Irish Mick

Flexible Return Values In An Inteface
Hi,
I'm trying to define a function in a VB6 Interface class that can return one out of two different kind of objects.
How can I do it without using Variant as the returned type?
I think defining an Interface both objects implement and use it as the retuen value would do the trick but is there an easier way?

Thanx

Output Parameters & Return Values
i have a stored procudere in SQL Server and i have this problem:
The stored procedure has a return value (@codice0) that can be read with sql analyzer, but i don't know how to get the value in visual basic.
for example:
'
in Query Analyzer
'
declare @myid int
EXEC @myid=sp_Class001_Insert 01,'AGHI','AGHI',4,20040525,1227,0
SELECT @myid
'
returns the value
'
' In Visual Basic
'
Myconn.execute "sp_Class001_Insert,'AGHI','AGHI',4,20040525,1227,0"
with this statement i don't know how to get the return value.

Thanks to all


Return Values Of An AxtiveX Control
I have created an ActiveX control (ocx) in VB 6 that basically shows a drive list box, directory list box, file list box and a plain list box.  What I want the user to do is to browse through thier system looking for files and once they find a file they want, add it to the list box.  I have all of this working, but now I need to get the values of the list box or the names of the files they selected back to the calling program.  I am assuming this would be something like a property of the ActiveX control, but have no idea on how to use it or get the values.  Anybody have any suggetions?

Thanks for you help,
Jason

Copyright 2005-08 www.BigResource.com, All rights reserved