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





See Related Forum Messages: Follow the Links Below to View Complete Thread

Datagrid & ADO Data Control
Newbie question. I have created a Datagrid control bound to an ADO Data Control using a particular database account and password at design time. How do I use a different account and password at run time? The datagrid control apparently wants to connect first using the design time account/password before I can change the connection using code. In other languages, data sources can be disconnected at design time. I don't see how this is done with an ADO control.

Any help greatly appreciated.

Datagrid: No Ado Data Control
I am trying to populate a datagrid control without having to bind it to an ado data control.

the data, however, is not being displayed. The recordset is retrieving the records from my database but nothing is being displayed in my datagrid.


Here is my code
dim rsS as adodb.recordset
set rsS=new adodb.recordset

rsS.CursorLocation = adUseClient
rsS.CursorType = adOpenStatic
rsS.LockType = adLockOptimistic
rsS.Open "Select School_ID,School_Name,Address,Telephone from School Order by School_Name", connection

Set dgSchools.DataSource = rsS


Do I have to loop through the recordset and set the datafield property of the datagrid columns to the fields in the recordset?

I thought that by setting the datasource property that would be automatically done.

Tesita

Datagrid,recordset % Ado Data Control
hi, i have a problem with datagrids.

i want to view the result of a query into a datagrid.
i created a recordset(rs) containing the data.
so, i added an ado data control(adodc1) , configured the connection and i wrote:

adodc1. recordsource =rs

after i wrote

set datagrid1.datasource=adodc1

but in the datagrid only the FIRST row of the recordset is shown?
why?

thanks

Clear Data From Datagrid Control?
can anyone help me with this...please..

how do I clear contents of datagrid control? thanks in advance...

How To Display Data In DataGrid Control
please tell me how to display data in DataGrid control, the simplest way to do it. please this is very urgent to me

Inserting Data Using DataGrid Control
On a form, I have a combo box and a data grid.

Based on user's select in the combo box, data grid displays certain data which is supplied by stored procedure.

ComboBox On_LostFocus()
dataGrid.dataSource = rsStoredProc
end ComboBoxSub

Thats how my dataGrid gets it data. I have set the AllowUpdates, AllowInsert, AllowDelete properties of the dataGrid to TRUE. But still there is no additional row on the dataGrid for the user to add data, neither can the user edit or delete.

What is wrong here. Please suggest.

thank you in advance!
Ankeet

DataGrid And ADO Data Control PROBLEMS!
Hi,

I am quite new to database programming in VB.

I have a database that keeps track of different types of accommodations.....and also all the different units that eacy accommodation has.

For example........one accommodation is "Hotel"
and units could be 1, 2, 3, etc

What i want to do is make the program automatically display all the units in a data grid control for the selected type of accommodation.

I've tried doing this...

Adodc2.RecordSource = "SELECT tblUnits.UnitNumber FROM tblUnits WHERE tblUnits.AccTypeID = " & txtAccTypeID.Text

in order to change the data, but this doesnt do anything...the same units are displayd no matter which accommodation type is chosen.

What is the best way to do this?.......any help or advice you can give me would be welcome.

Thanx,
Clint

Data Control & DataGrid Ocx Problem
Hi,
I’m using a VB6 Pro SP4 (the latest). Here’s the problem:
1. I add Data control and DataGrid control (MSDATGRD.OCX) to the form
2. I connect Data control to Biblio.MDB and set RecordSource to one of the tables (Authors)
3. When I try to set DataSource of DataGrid I get the following error

Error Message:
No compatible data source was found for this control. Please add an OLEDB data source such as Data Enviroment or Microsoft ADO Data Control to the form or project.

I also get this message:

Error Message:
Can't bind this control to Data1. Select a different data source (eq - ADODC1, or DataEnviroment1...)

I would really appreciate your help for I need to use data control & bound it to data grid ocx.

Thanks.

Clear Data From Datagrid Control?
I am use to using the MSHFlexGrid and now since the datagrid is a .NET control and the FlexGrid is a COM control I am using the datagrid now. This is a really basic question. I have a datagrid I add data to from an Excel Doc using OleDb. Once it is filled with the file my program allows you to export the data. What I need is this how do I clear the datagrid when I import data from another Excel doc? There is no DataGrid1.Clear method.

Adding Data In DataGrid Control
Hello Friends,
     i am using DataGrid Control and bounded it with database of SQL Server amd adding or updating data from Grid. But the problem is some times it will allow to add or update and sometimes it is not allowing me. I am also selected AddAllowNew property become true.
   so what can i do plz reply me


SPPatel



Edited by - sppatel237 on 3/10/2004 7:52:00 PM

Changing Data In A Datagrid Control
I'm trying to modify data in a DataGrid control through code. I'm able to read what's currently there, but i can't seem to find the property/method that will let me change the data in a certain cell. I'm guessing it MUST be possible, since the user can do it during runtime. Any help would be greatly appreciated.


Thanks

Modifying Data In Datagrid Control ?
hi,
I set up my datagrid control based on a command object in a data environment.
Everything displays nicely, except that I can't edit, add or delete anything.
Does anybody know why ?

thanks,
Maggie

Problem Using An ADO Data Control And An ADO Datagrid In Excel.
Hi,

I'm trying to use an ADO Data Control and link a ADO DataGrid to it to be able to browse/update an Access DB Table. Normal in VB6.0 you setup the ADODC and then just assign the Datasource property of the DataGrid to be the ADODC and it works. In Excel there is no Datasource property in the properties window and when I try to do it through code int the Form Initialise event I get the following error 'Method or Data Member not Found'.

Does anybody have any ideas what I'm doing wrong or how you link a DataGrid to an ADODC in Excel?


Thanks,
Phil.

Datagrid Control Does Not Refresh With Data Environment
Dear Friends,

I am facing a problem with DATAGRID IN VISUAL BASIC 6.00.

I am using a DATAENVIRONMENT with a Connection Object that has OneCommand Object.
The command Object uses the Following Parametric SQL Statement.

SELECT * FROM mondet WHERE cntno=?

Pls note that Mondet is a child table with multiple entries in CNTNOfield - (ACCESS Table)

The Datagrid has the following Data Properties (Thru the PropertiesPage)
The Name of The Data Environment is DE1
the Name of the Command Object is COMMAND1

DATAGRID1.DATASOURCE=DE1
DATAGRID1.DATAMEMBER=COMMAND1



The Datagrid refreshes the first time. But when we run the parametricSQL Statement again to create a new


Recordset, a new Recordset is Created (Checked the Recordcount Propertyof RECORDSET in MSGBOX)


but the DATAGRID is not updated. I have Tried "Rebind", "Refresh"Methods etc. but to no avail.


Infact even the "Clearfields" method does not Work after the FirstRecordset is Created.

Can Anyone of You Help Me out. Pls See that the Datagrid works fine(also Refreshes) with a ADODC Control. But I


Need DATAENVIRONMENT control to be used.



Thanx in Advance

Vinay Vekkot

Import/link XLS To Datagrid Using Data Control
How can I import/link excel file to datagrid using data control,
by coding.



Thank's
Jordan Sparta

Error 0 On DataGrid Linked With Ado Data Control
Does anyone know why I would get error 0 every time I touch the datagrid
during runtime(ie/update, etc)....Which library(s) do I have to reference to
use the datagrid and the ado data control?

Any help would be appreciated!! Thanks
Sonia

Automation Error (440) With ADO Data Control & DataGrid
                    Hello -
                    I am using VB6 against a SQL Server 7 db.

                    This is a very simple program whereby the datagrid is populated
                    by Adodc1  without any VB code.

                    I added a Timer control to refresh the data grid every 10
                    seconds   (Adodc1.Refresh)   This works very well.

                    Problem:  The program runs fine, refreshing the grid
                    periodically....  then after running for several minutes
                   (seems to  always be about 4 - 5  minutes)  get the
                   run-time    Automation   error (error 440)

                    The documentation for Error 440 says -" An error occurred
                    while  executing  a method"

                    Well,  the only method being executed is the .Refresh

                    I can only guess that there is a Timeout problem occurring
                    or  the   SQL Server db  is too busy to respond...?

                    I took the default values for Connection Timeout etc when I created
                    the controls.


                    Has anyone had experience with Automation errors?
                    Thanks for any help.
                    John

Insertion Of Data Using Datagrid Control. VB + SQL Server
Hi,
   I have a problem in inserting the new record's data in DataGrid control.
I have got 2 tables. One table has a foreign key referring to the primary key of other table. Now records exist in primary key table and I am displaying the foreign key table in the Datagrid control. The fields displayed are partial for I dont want user to view all the fields of the table. Some to the fields get updated later as per the programming logic. But when I insert new record corresponding to the left out fields an error is displayed stating cannot insert null value.

Plz suggest a possible solution.

 

Unable To Link DataGrid To Data Control
I am using a Jet (Access) database with ADO. I am trying to display the data from my data control in a data grid. When I try adjusting the 'Data Source' property of the data grid, I get the following message "No compatible data source was found for this control. Please add an OLEDB data source such as the Data Environment or Microsoft ADO Data Control to the form or project." I get this message even though my Data Control is already on the same form.

Date Format Using ADO Data Control And DataGrid
When using the DataGrid with the ADO Data control in VB6 to view info from Access 97 databases, all "Date" fields are shown in US format. How do I display dates in UK "dd/mm/yy" format.
(The regional settings in control panel are set correctly for UK dates)
Note: Various Recordsets will have the "Date" field in different field positions.

Updating MS Access Table With ADO Data Control From A Datagrid
Hi,

I'm populating a datagrid with the data of a MS access table using ADO Data Control. If I change the datagrid values, its automatically updating the table contents. Is there any property of the ADO data control, so that only on setting that value, the data grid changes should be reflected in the DB & not otherwise.

regards,
narayan

Datagrid Control, Enter Data Like A Excel Sheet
Hello

I have implemented a datagrid which is connected to a database. I want the user to be able to press the tab key to be able update the cells in the grid, and also be able to select certain cells with the mouse and update them as well.

It is possible to have some code on how to do this.

Many thanks in advance

Steve

Particular Data Should Transfer From Datagrid 6.0 Control To An Excel Sheet
particular data should transfer from datagrid 6.0 control to an Excel sheet ...?

Binding A DateTimePicker And/or ListBox To DataGrid To Control/restrict Input Data.
I have a DataGrid control with certain editable columns (some Numeric, some Date/Time fields) for which I would like to control/restrict input data. I want to acheive this by displaying a ListBox control or DateTimePicker control (as appropriate for that column) when a user clicks on the button in the cell.

I can display such controls external to the grid on the Button_Click event of the grid but I would rather have these pickers intrinsic to the grid...sure we've seen these all over the place?

Thanks in advance

Refresh DataGrid(Microsoft DataGrid Control 6.0)
Hi,

I am having a problem refreshing the datagrid in the following scenario:

I have Form1 with ADODC control and DataGrid(Microsoft DataGrid Control 6.0). The grid (is used to display employee records) contains 5 columns (for example Office telephone number) . On clicking of a row on the grid the details window opens up. This window is used to update the employee information. On saving the employee record if Office telephone number is changed then the datagrid should be refreshed with latest data of the record. The refresh is done using the following command:
msgbox "activate"
adodcobject.refresh
datagridobject.refresh.

If the message box is commented then the refresh statements do not get executed. I need a solution for that.

Regards,
Rashmi.

How To Transfer Data In A Datagrid To Another Datagrid..?
Please help me in my project so that i can pass..

Im a freashman student in high school,
Im making a simple Computer Hardware Inventory system,

Datagrid1:
Item Description Serial Number Date Recorded
Mouse Optical SN-2007 03/27/2007


Datagrid2:
Item Description Serial Number Date Recorded


I want my data in datagrid1 will transfer to Datagrid2
please solve my problem..

youre help, is a big help to me!
Thank you in advance!! Godspeed!!

How To Copy Data From Datagrid Another Datagrid?
my problem is like that---

now i have 2 datagrid---datagrid1 & datagrid2
and 2 adodc-----adodc1 & adodc2

i have build some text that link with adodc1,i wanna build a command button that when i press it then the data from the text will copy to datagrid 2 and i can save it.


can any 1 show me the way?

thanks

How Do I Get This Information Into A Datagrid Control (datagrid)???
I have this information that i want to call out of a file and put into a data grid.
"AL","Alabama"
"AK","Alaska"
"AS","American Samoa"
"AZ","Arizona"
"AR","Arkanzas"
"CA","California"
"CZ","Canal Zone"
"CO","Colorado"
"CT","Connecticut"
"DE","Deleware"
"DC","District of Columbia"
"FL","Florida"
"GA","Georgia"
"GU","Guam"
"HI","Hawaii"
"ID","Idaho"
"IL","Illinois"
"IN","Indiana"
"IA","Iowa"
"KS","Kansas"
"KY","Kentucky"
"LA","Louisiana"
"ME","Maine"
"MD","Maryland"
"MA","Massachusetts"
"MI","Michigan"
"MN","Minnesota"
"MS","Mississippi"
"MO","Missouri"
"MT","Montana"
"NE","Nebraska"
"NV","Nevada"
"NH","New Hampshire"
"NJ","New Jersey"
"NM","New Mexico"
"NY","New York"
"NC","North Carolina"
"ND","North Dakota"
"OH","Ohio"
"OK","Oklahoma"
"OR","Oregon"
"PA","Pennsylvania"
"PR","Puerto Rico"
"RI","Rhode Island"
"SC","South Carolina"
"SD","South Dakota"
"TN","Tennessee"
"TX","Texas"
"TT","Trust Territories"
"UT","Utah"
"VT","Vermont"
"VA","Virginia"
"VI","Virgin Islands"
"WA","Washington"
"WV","West Virginia"
"WI","Wisconsin"
"WY","Wyoming"

And i want to get it into a data grid.
How do i do this??????

How Do I Get This Information Into A Datagrid Control (datagrid)???
I have this information that i want to call out of a file and put into a data grid.
"AL","Alabama"
"AK","Alaska"
"AS","American Samoa"
"AZ","Arizona"
"AR","Arkanzas"
"CA","California"
"CZ","Canal Zone"
"CO","Colorado"
"CT","Connecticut"
"DE","Deleware"
"DC","District of Columbia"
"FL","Florida"
"GA","Georgia"
"GU","Guam"
"HI","Hawaii"
"ID","Idaho"
"IL","Illinois"
"IN","Indiana"
"IA","Iowa"
"KS","Kansas"
"KY","Kentucky"
"LA","Louisiana"
"ME","Maine"
"MD","Maryland"
"MA","Massachusetts"
"MI","Michigan"
"MN","Minnesota"
"MS","Mississippi"
"MO","Missouri"
"MT","Montana"
"NE","Nebraska"
"NV","Nevada"
"NH","New Hampshire"
"NJ","New Jersey"
"NM","New Mexico"
"NY","New York"
"NC","North Carolina"
"ND","North Dakota"
"OH","Ohio"
"OK","Oklahoma"
"OR","Oregon"
"PA","Pennsylvania"
"PR","Puerto Rico"
"RI","Rhode Island"
"SC","South Carolina"
"SD","South Dakota"
"TN","Tennessee"
"TX","Texas"
"TT","Trust Territories"
"UT","Utah"
"VT","Vermont"
"VA","Virginia"
"VI","Virgin Islands"
"WA","Washington"
"WV","West Virginia"
"WI","Wisconsin"
"WY","Wyoming"

And i want to get it into a data grid.
How do i do this??????

How To Print The Searched Data From Datagrid Using Data Report ?
I have a problem in generating reports using datareport. My connection used to connect to MsAccess was Adodc. Now, the problem is that, whenever I'm going to search for a particular data in the datagrid it doesn't appear in the datareport all alone. It is always accompanied by all the other data that I had saved in the database. What should be the code for that? in order to print just the data that I am going to search....

Using Active X Control(Datagrid Control) In MSAccess (NOT Resolved)
Hi,

Does anyone know how to assign a record source to a data grid control in Msaccess. Iam unable to find a Data source/Record source property/method in it.

Thanks.



Edited by - XTab on 4/8/2003 12:45:52 AM

How To Control Tab/enter Order In A Datagrid Control
Hi,

Assume i have a datagrid1 on my screen with 3 columns, name, mark and age.

I created a recordset called rst1 which sql statement is 'select name, age from student'.

I have another recordset called rst2. I appended 2 columns into rst2 using following code:
>> rst2.Fields.Append "Name", adVarChar, 20
>> rst2.Fields.Append "Mark", adDouble
>> rst2.Fields.Append "Age", adInteger

Then i copy Name from rst1 to rst2 using following code:

>> If rst1.BOF = False Or rst1.EOF = False Then
>> Do While rst1.EOF
>> rst2.addnew
>> rst2.Fields(0) = rst1.Fields(0)
>> rst2.Fields(2) = rst1.Fields(1)
>> rst2.Update
>> rst1.movenext
>> loop
>> end if

Then i set rst2 as my datagrid1's datasource:
>> Set .DataSource = adoRstQcShipmentTest

Now i got a populated datagrid with 2 columns, first column contains student names, second one is empty, third one is student age.

What i want to do now is enter mark for each student.

My Question here is how can i control the tab order? I hope the cursor can always keep in the second column (because i only need to enter data in that column). For example, when i entered mark in row 1, then i press TAB or ENTER, i hope the cursor can move to column2 in row2. But now it will move to columns3 in row1.

Please help
Grace

Beside VB 6.0's Default Datagrid & Tab Control, Which Is The Best 3rd Party Control
I m doing my new project on database application and i want my application look nice and user friendly.
I don't like the look of visual basic 6.0's default datagrid control and tab control.........Please could any one tell which is the best 3rd party datagrid control and 3rd party tab control (container).
Thankx

Beside VB 6.0's Default Datagrid & Tab Control, Which Is The Best 3rd Party Control
I don't like the look of visual basic 6.0's default datagrid control and tab control.........Please could any one tell which is the best 3rd party datagrid control and 3rd party tab control (container).
Thankx

How To Connect Microsoft Data Grid Control To Data Control?
Hi all

I am using VB6 and I want to connect Microsoft DataGrid control 6.0(OLEDB) to a data control on the form. I placed the datacontrol on the form and set the data source property to the desired database file, then placed the DataGrid control. Then if click on the data source property of the DataGrid i get the following message box with the following message:

"No compatible data source was found for this control. Please add an OLEDB data source such as the Data Environment or Microsoft ADO Data Control to the form or project"

What is the problem? I want to use the DataGrod itself. Any body help?

Get Data From Datagrid
Hi, anyone can help me solve this problem? I make a code to get data from datagrid, but it can not run. The code show as below

***************************************************
dim mgstrLocCode as String

Private Sub PrvGetValue()
If DataGrid1.ApproxCount <> 0 Then
mgstrLocCode = Get_Recordset_Value("LOC_CODE", Adodc1)
End If
End Sub

Function Get_Recordset_Value(fldname As String, Data1 As Adodc) As String

On Error GoTo ErrClick

If IsNull(Data1.Recordset.Fields(fldname)) = True Then
Get_Recordset_Value = ""
Else:

Get_Recordset_Value = Data1.Recordset.Fields(fldname)
On Error GoTo ErrClick
End If


Exit Function

ErrClick:

Exit Function

End Function
***********************************************

How Do I Get Data To Appear In Datagrid
the only thing i have on my form is a datagrid and an ADO data control.
i have the datasource of the datagrid set to my ado data control.
it is the only property i set for the datagrid.
i did not set any properties for my ado control instead i have the following code. How to i get the data to appear in my datagrid.

Code:
'option explicit
Dim conn As ADODB.Connection
Private Sub Open_database()
Set conn = New ADODB.Connection

With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "c:db1.mdb"
.Open
End With

End Sub
Private Sub Recordset_info()
Dim strSQL As String
Dim rcst As ADODB.Recordset
Set rcst = New ADODB.Recordset
strSQL = "Select * from Phase1b"

With rcst
.Source = strSQL
.ActiveConnection = conn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open
End With




End Sub

Private Sub Form_Load()
Call Open_database
Call Recordset_info



End Sub

Get Data From Datagrid In Another App
I've got a client that has an existing program. The developer is pretty much an @ and isn't offering her the support, breaking other software everytime he does an update to his software and she is looking to redevelop the application. Here's the problem. All the data she has entered is stored in about 10 access databases (I have no idea why each one is about 100k) and its nothing more than a financing program to track payments from customers. Anyway, the databases are locked, as in they can't be opened with access without passwords, and he of course wont come off with the password or source code so we are trying to find a way to get the customers and payments out of this program and into a new one. The only way I can think to do it is to open the program and display the datagrids and somehow export the datagrids into a new file, i don't care what another database, csv file whatever. I know there are programs out there what will say to a mouse over, tell you a window or dialog name and properties, but is there some way to access the data in these datagrids and other misc controls (text boxes, combo box, etc) Ideas?

Getting Data Out Of The Datagrid
Hello

I am using the datagrid control, and i want the user to select a record in the grid, and then display that record information into text boxes. How do l get the data out of the grid?

Any example code would be most grateful

Many thanks in advance

Steve

Getting The Row Data In A Datagrid
How can I get the data of a particular row in a datagrid, I see the other thread with the TextMatrix but datagrid have not this properties

Getting Data From The Datagrid
hi there, anyone there to help???

i need to capture the value of the selected row from the datagrid. How am i going to do that???

for example, i have i list of staff with their particluars, and when i click on the row, i can get the selected data from the grid...

thankz man, in advance....

Get Data From DataGrid
Hi Gurus,
How to get the data that I inputted in the DataDrid control. For example I was editing the cell of Column 2 and row 2, I want to get this newly inputted data after I pressed the Enter key.
The DataGrid is using ADO recordset not the Data Control or Data Environment. I will use this data for Update to the database by using Update Set statement.

Many thanks in advance.
MsJane

MS DataGrid Control
using the Microsoft DataGrid control...
How do I prevent it from updating the previous record when focus gets moved to a new record?

DataGrid Control
Hi All,

When populating a DataGrid Control - the data populates OK

The code does updates textboxes when a whole row is selected using Bookmark property

However When i try to scroll up and down using arrow keys the result set are NOT updated in text boxes. Any ideas on how to do this??

Chet

DataGrid Control Bug...
Hi,

I have notcied that the DataGrid sometimes works and sometimes doesn't. I used the DataGrid to display a list of invoices which worked the first few times. But if you change too many of the DataGrid propertys it loses its functionlity. Is this a bug or is it like that. What I mean is I changed the font about 5/6 times and it stopped readding the data. When I removed that DataGrid and replaced it with a newone and renaming it it began to work again. Currently, it stills keeps "switching" like described earlier, at this is really anooyin as there are large amount of users who are going to be using this application.

Any thoughts/Comments, greatly appreciated as always...
VD

DataGrid Control Help
Hi!!

I want to display the query results into my form. i thought a DataGrid might be the solution.

The problem I have now is that I don't know how to link the query results into the DataGrid... I also want the data grid to display some other data (this data will do some calculations of some data of the query) So I want to add more columns to the data grid.
Do you know how can I do this?
Do I have to use another thing???

Thanks in advance!!

DataGrid Control
Does anyone know how to enable a specific row of data in a data grid to be highlighted first before a user can delete it, using a command button and not pressing [del]?

Using The Datagrid Control
How do i make one of the columns in the datagrid control as a
combobox (datacombo is better) and place data in the combo
listfield from one table and to the datafield from another
table wich both are connected?

Secondly, how do i make a specific column wich shows boolean
data as checkbox in run time?
when i make it in design time it still shows 0 or 1 rather
than a checkbox.

DataGrid Control
I have a problem with DataGrid Control. I fill it with data,ok? but this information are not visible totally --> I need to use scroll up and scroll down to view it, ok? But when I use the wheel mouse, datagrid control scroll down/up a little and it stops in fact.

What does it happen?


Thanks for all,
Excuse for my english, I'm a catalonian student.

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