Hi Looks like I can get some help here!Does anyone know how I can connect ADODC to a Flexgrid? I\'m new to vb and I\'d really appreciate any help!!The adodc is connected to a db in server2000.
17-05-2004 at 01:37 AM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
Re: Flexgrid and ADODC
Set YourFlexGrid.DataSource=YourAdodc
Bye
____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell
17-05-2004 at 08:33 AM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
Do you have a sample coding for it?
18-05-2004 at 05:39 AM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
How do I set the titles of the grid and and assign each column in the table of the ADODC to each row and column of the grid?Thanks for replying earlier!!
18-05-2004 at 05:42 AM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
When I replace this coding with ur connection coding it gives me an error. The first error highlights "1" aft SQLOLEDB? Do u have an alternative to find the connection string. Thank you sooo much for helping me out!!
I have attached my project in VB 6.0 so that u'll have an understanding of wut I'm trying to do here. I'm trying to add the flexgrid to purchase order tab.
Also I would really appreciate if you can main an example coding for example in the vendor form if the vendor no is selected in a combo box for the vendor name to appear in a text box. There's a separate adodc for vendor connected to the database.
19-05-2004 at 03:44 AM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
Note: In order to connect to a SQL Server 2000 "named instance", you must have MDAC 2.6 (or greater) installed.
I don't understand your request.
quote:
Also I would really appreciate if you can main an example coding for example in the vendor form if the vendor no is selected in a combo box for the vendor name to appear in a text box. There's a separate adodc for vendor connected to the database.
what i understand is when u select a vendor in a combo box u want to display name in a text box , right?
but your combo is filled with a recordset or something else?
Bye
____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell
19-05-2004 at 10:51 AM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
umm yea it was connected to the Purchase Order recordset(Combo)But if there's a alternative I'm glad to implement it
19-05-2004 at 03:01 PM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
Re: Flexgrid and ADODC
I work in this way:
to load a combobox
Public Sub LoadCombo()
Dim strSQL as String
Dim rsAdo1 as ADODB.RecordSet
strSQL = "SELECT ID,Field FROM YourTable"
Set rsAdo1 = New ADODB.Recordset
rsAdo1.Open strSQL, yourConnection
The Grid works but the combo does not load the data to the menu in the combo.
To for my project to be alive I'll have to use your way of calling from the strConnection.
As I have the ADODC connected to the other tabs my project it doesnt not work in mine. So to change from ADODC connection to declaring the connection in the module and calling it in the form, how do I change the text boxes that I have in my form. For example, in customer , whats the coding to make the Customer Address appear in the text box using strConnection.
Basically what I'm asking is for the coding for Customer Address to appear in a text box using ConnectionString and ADODB.Connection in the module.
21-05-2004 at 02:30 AM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
Hey!
Luckily I sent my project to you. Hope u havent deleted it. This is for one of my units from uni. After I tried the connection string in my program the interfaces got locked. Cud u mail back the coding I sent to u. I kept a back up of the database but not hte VB prog.
Thanks!!
21-05-2004 at 05:48 AM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
Re: Flexgrid and ADODC
Look in the LoadCombo , in SQL statement:
strSQLCombo = "SELECT C_No FROM Customer"
u have to when user select by combo , make another sql statement that take your customer address.
Sound like:
Private Sub Combo1_Click()
Dim rs as ADODB.RecordSet
dim str as String
If Me.Combo1.ListIndex <> 0 Then
str="SELECT Address FROM Customer
str=str & " WHERE C_No=" & Combo1.ItemData(Combo1.ListIndex) & ""
set rs = New ADODB.RecordSet
rs.Open str,cnAdo
if rs.EOF=False Then
Text1.Text=rs.Fields("Address").Value
End If
set rs=Nothing
End If
End Sub
the connection remane the same you have to open another recordset with another SQL statement.
Here's your old code.
Bye
____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell
Thanks again I'll try that out. I mean the code of the Invoicing System with the 4 tabs(Customer, Accounts Payable. Receivable etc) in one form(frmFrontier_main) and Vendor. Hope u can find the project I'm talking about.(Frontier)
21-05-2004 at 02:58 PM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
sorry about that I found the project I was refering to earlier. The combo does not load any data yet. Wonder y?Even when I run the example u sent the combo did not load any data.
This is the coding in the form
Private Sub Combo1_Click()
Dim rs As ADODB.Recordset
Dim str As String
If Me.Combo1.ListIndex <> 0 Then
str = "SELECT V_No FROM Vendor"
str = str & " WHERE V_No=" & Combo1.ItemData(Combo1.ListIndex) & ""
Set rs = New ADODB.Recordset
rs.Open str, cnAdo
If rs.EOF = False Then
Text1.Text = rs.Fields("V_No").Value
End If
Set rs = Nothing
End If
End Sub
This is the coding in the module
Global cnAdo As ADODB.Connection
Global strConnection As String
Set cnAdo = New ADODB.Connection
cnAdo.ConnectionString = strConnection
cnAdo.Open
frmvendor.Show
End Sub
The connection is working as in the grid the data appears in the column.
22-05-2004 at 03:02 PM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
Hi Again!
on top of the combo question I posted last I have another question. Hope u can help me out. I had to take the adodc out in all the tabs in my project coz I cudnt add a data environment to print reports with a adodc. I'm able to print reports but I'm unable to add records with this code.
deFrontier is the Data environment. rs is the Connection. Earlier it used to be the table name.recordset.addNew. I tried replacing it with the data Environment name.connection.addnew but it doesnt seem to be working. Do you have any other alternatives
Private Sub cmdC_Add_Click()
txtC_No.Enabled = True
txtC_Name.Enabled = True
txtComp_Name.Enabled = True
txttypeBiz.Enabled = True deFrontier.rsCustomers.AddNewEnd Sub
24-05-2004 at 01:35 AM
|
BRMC Level: VB Lord Registered: 28-11-2003 Posts: 210
Re: Flexgrid and ADODC
Hi,
for adding new record i use INSERT INTO in sql like:
Private Sub cmdC_Add_Click()
Dim rs1 as ADODB.RecordSet
Dim strSQL as String
set rs1=New ADODB.RecordSet
rs1.Open strSQL,yourconnection
set rs1=Nothing
End Sub
Bye
____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell
24-05-2004 at 07:28 AM
|
RonikaA Level: Guest
Re: Flexgrid and ADODC
hi
Thanks for ur reply.I appreciate it!I'll try that..Umm how should I use sql to rfresh and del? Hope u saw the question I posted on combo question. I have pasted it here any way!
The combo does not load any data yet. Wonder y?Even when I run the example u sent the combo did not load any data.
This is the coding in the form
Private Sub Combo1_Click()
Dim rs As ADODB.Recordset
Dim str As String
If Me.Combo1.ListIndex <> 0 Then
str = "SELECT V_No FROM Vendor"
str = str & " WHERE V_No=" & Combo1.ItemData(Combo1.ListIndex) & ""
Set rs = New ADODB.Recordset
rs.Open str, cnAdo
If rs.EOF = False Then
Text1.Text = rs.Fields("V_No").Value
End If
Set rs = Nothing
End If
End Sub
This is the coding in the module
Global cnAdo As ADODB.Connection
Global strConnection As String
I have attached the wrong project. Herewith is attached the correct one!Still the combo does not show any data. The combo should show data at load and select the data to the text at click?