DataControl ---> Data "object" HowTo???
-
I have a data control and I need to pass in a Data object in a function's parameter. I'm the one making the function, so I can change it to a recordset, which is "ok" but it just doesnt make a whole lot of sense to do 1/2 of what i want to do outside of a function, and the rest inside of a function! (if i would pass a recordset) So any suggestions? my boss remembers doing it but he forgot how. (uhh huh, yeah ok) I believe it can be done, but all i want is a Data object, because that's the only thing i've really messed with in messing with Databases (i'm pretty new to VB but a veteran to C++) Ok, thanks in advance! ~Timothy T. Rymer http://tim.xpertz.com http://www.digipen.edu http://www.ttrx.com
-
I have a data control and I need to pass in a Data object in a function's parameter. I'm the one making the function, so I can change it to a recordset, which is "ok" but it just doesnt make a whole lot of sense to do 1/2 of what i want to do outside of a function, and the rest inside of a function! (if i would pass a recordset) So any suggestions? my boss remembers doing it but he forgot how. (uhh huh, yeah ok) I believe it can be done, but all i want is a Data object, because that's the only thing i've really messed with in messing with Databases (i'm pretty new to VB but a veteran to C++) Ok, thanks in advance! ~Timothy T. Rymer http://tim.xpertz.com http://www.digipen.edu http://www.ttrx.com
I'm not sure if this is what you are looking for.... You might what to do a search for "Data aware class" on the MSDN. Private Sub mysub(Data As Object) End Sub
-
I have a data control and I need to pass in a Data object in a function's parameter. I'm the one making the function, so I can change it to a recordset, which is "ok" but it just doesnt make a whole lot of sense to do 1/2 of what i want to do outside of a function, and the rest inside of a function! (if i would pass a recordset) So any suggestions? my boss remembers doing it but he forgot how. (uhh huh, yeah ok) I believe it can be done, but all i want is a Data object, because that's the only thing i've really messed with in messing with Databases (i'm pretty new to VB but a veteran to C++) Ok, thanks in advance! ~Timothy T. Rymer http://tim.xpertz.com http://www.digipen.edu http://www.ttrx.com
You are better off passing the recordset object if thats what you are going to be playing with. Otherwise you are using late binding. Something like this : Sub DrawData(ByVal oRec as ADODB.Recordset) Dim dField as Field For Each dField in oRec.Fields MsgBox dField.Value & " " & dField.Name Next End Function Sub Main() Dim oRecord as ADODB.RecordSet Dim ssql as String Dim oConnect As ADODB.Connection oConnect.Open "Blah,Blah" ssql = "SELECT * FROM table1" oRecord.Open ssql, oConnect, adOpenForwardOnly, adLockReadOnly DrawData(oRecord) MsgBox "Success" End Sub