[RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
Oh God this is KILLING ME!! :eek2:
First of all, please don't tell me I didn't bothered searching for an answer in other posts. I've spend 2 whole days seeing if my problem was already solved in other threads/posts.
So please be gentle and try to help me.
My problem is the following:
* I'm using vb6, ADODC and DataGrid
* I ALREADY have loaded in my form the ADODC (already and correctly linked to my database), the DataGrid (already and correctly linked to the ADODC) and some other TextBox linked as well with ADODC.
* Everything is fine, it all works perfectly. NOW: I just want to give to my ADODC the simplest SQL instructions, and I don't know how, beacuse all the info I got from VBForums is regarding NEW Ado controls, (not previously loaded).
Please, note that I already know what commands I want to send to ADODC, and I already know how to do it with new controls.
I also know how to set the ADODC with a starting SQL instruction, via ADODC's Properties
You may ask why I want to know this if I already know how to do it with new controls. It's because it's so easy to just set the ADODC from VB, not via code. I just put it in the place I want it, the size I want it, to select via browser... to link TextBoxes and it all works so neat, so automatically... Come on! It has to be a simple way, something like:
ADODC1.RecordSet.DO SQLInstr
Thank you, and please excuse any mispellings or grammatical errors, english isn't my motherthonge.
Re: VB6 + ADODC = Terrible headache! Please please please help me...!
I haven't worked with databound controls. But here's a thought:
Code:
ADODC1.DataSource="SELECT * FROM myTableName"
Try it...:wave:
Some useful stuff for you:
Re: VB6 + ADODC = Terrible headache! Please please please help me...!
Quote:
Originally Posted by
akhileshbc
I haven't worked with databound controls. But here's a thought:
Code:
ADODC1.DataSource="SELECT * FROM myTableName"
Try it...:wave:
Some useful stuff for you:
Hi!
Thank you a lot, but no.
1) I've tried it a lot and it doesn't work.
DataSource is not a member of ADODC
(ADODC.DataSource doesn't exist)
However, although ADODC.Recordset.Datasource is a valid variable, I cant use it in any way. I can't even:
PRINT ADODC.Recordset.Datasource
a=ADODC.Recordset.Datasource
ADODC.Recordset.Datasource = SQLCode
the first and second one result in Error #13: Type mismatch
and the 3rd one results in "Method or data member not found"
2) Those link were very very purple: I've visited over and over again.
:(
But thanks
Re: VB6 + ADODC = Terrible headache! Please please please help me...!
from msdn
Quote:
Creating a Simple DataCombo Application
The following example uses the DataCombo box control to create a data entry screen for the Titles table of the Northwind.mdb sample database. It lets the user enter new products and assign them to existing suppliers by providing a lookup table of all the suppliers' names. When users get to the Supplier field in the entry form, they can choose a supplier from a list box. When they select a supplier, that supplier's SupplierID field is copied into the SupplierID field of the Products table.
To create a lookup table with the DataCombo control
Create an OLEDB Data Source for the Northwind database.
If a Data Source has not been created, follow the steps in "Creating the Northwind OLEDB Data Source."
Create a new Standard EXE project in Visual Basic.
If the DataGrid, DataCombo, or ADO Data Control is not present in the Toolbox, right-click the Toolbox, and use the Components dialog box to add it.
Add a DataCombo, two ADO Data controls, and a DataGrid control to your form.
In the Properties window, set the properties of the first data control (Adodc1) as shown in the table below.Property Setting
Name adoDataSource
ConnectionString Northwind.udl
RecordSource Select * From Products;
Caption Products
In the Properties window, set the properties of the second data control (Adodc2) as shown in the table below.Property Setting
Name adoRowSource
ConnectionString Northwind.udl
RecordSource Select CompanyName, SupplierID From Suppliers;
Caption Suppliers
Visible False
In the Properties window, set the properties of the DataGrid control as shown in the table below.Property Setting
Name grdProducts
DataSource AdoDataSource
Caption Products
In the Properties window, set the properties of the DataCombo control as shown in the table below.Property Setting
Name dcbSuppliers
DataSource adoDataSource
DataField SupplierID
RowSource adoRowSource
ListField CompanyName
BoundColumn SupplierID
Finally, add the following code to the form's code module:
Private Sub Form_Load()
' Hide the SupplierID field in the DataGrid control, so the user is
' not confused on which value to change.
grdProducts.Columns("SupplierID").Visible = False
End Sub
Run the project.
You can navigate through the recordset by clicking the arrows on the visible ADO Data control. As you do so, the DataCombo control will update and display the name of the supplier for each product. To edit the SupplierID field, click the DataCombo control's arrow to display a drop-down list, then click again on a different supplier to change the value written to the SupplierID field.
looks like you want to set the recordsource property of the adodc control
sorry the tables did not paste too well
Re: VB6 + ADODC = Terrible headache! Please please please help me...!
Ahhhhhhh.......... sweet relief!!!!!
I only needed 1 sweet word to bring me back to life! RecordSource!
All you need to execute SQL in vb6 is:
Code:
ADODC.RecordSource = SQLCommand$
ADODC.Refresh
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
i never like to use bound controls, there are several discussions, in this and other forums, why to avoid using them
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
If I am not wrong,ADODC is obsolete in Vista/Win7.
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
Quote:
If I am not wrong,ADODC is obsolete in Vista/Win7.
so is vb6, but we are still using
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
VB6 is out of date, but the runtimes are still supported on Vista and 7... I think Jonney is referring to something about the ADODC specifically being an exception to that, but I can't remember any details myself.
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
Quote:
Originally Posted by
si_the_geek
VB6 is out of date, but the runtimes are still supported on Vista and 7... I think Jonney is referring to something about the ADODC specifically being an exception to that, but I can't remember any details myself.
I remembered I saw this info on expert exchange or somewhere.But I can't find now.
http://msdn.microsoft.com/en-us/libr...vb6.adodc.aspx
http://www.vbforums.com/showthread.php?t=617205
Re: [RESOLVED] VB6 + ADODC = Terrible headache! Please please please help me...!
There can be other confusing issues with the ADODC. If you're using a version prior to VB6 SP4 the ADODC is compiled against ADO 2.0, while the newer versions of the ADODC were compiled against ADO 2.5. In most circumstances the IDE will sniff this out and upgrade an ADO 2.0 reference to 2.5, but if you referenced ADO 2.6 or later all bets are off.