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




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Datagrid Won't Display Data
Set con = New ADODB.Connection
con.ConnectionString = "File Name=" & mstrDatabasePath
'mstrdatabasepath = "C: est.udl"

con.Open
Set rst = New ADODB.Recordset


rst.Open txtSQLString.Text, con, adOpenStatic, adLockOptimistic, adCmdText

Set dbgoutput.DataSource = rst

It just stopped working all of a sudden, syntactically I didn't change anything. The weird thing is I can generate XML, delimited, and HTML based upon the SQL taken from the textbox.

Any idea what might cause this?

Display In DataGrid Control
Hello everyone! First of all, I apologize profusely if this post makes little sense. It's late and I'm sooooo tired and this silly problem is not helping any.

Anyway, here goes:
I have a Data Grid Control on my form called dgdHistory and Adodc callled adoHistory. My problem is that I have tried to link the Adodc control to my Data Grid Control to display the records but it does not display any records. I know it is pulling and working with the recordset because it calculates the correct totals at the end, but no records are displayed in the Data Grid Control.


Code:

rs.Open strSQL, sConn, adOpenKeyset, adLockPessimistic, adCmdText
With adoHistory
.ConnectionString = sConn
Set .Recordset = rs
End With
Set dgdHistory.DataSource = adoHistory
dgdHistory.Refresh
With adoHistory
Do Until rs.EOF
sngCostTotal = sngCostTotal + rs.Fields("TotCost")
sngRateTotal = sngRateTotal + rs.Fields("TotRate")
intTotMin = intTotMin + rs.Fields("Duration")
rs.MoveNext
Loop
End With
Can anyone see what I am doing wrong?

Display Fresh Data On Datagrid
Hello, I'm deleting (recordset.delete) certain rows shown through a datagrid control.When i click update (recordset.update), the datagrid doesn't show the updated record and it will load & show the updated record only when i unload and reload the form, or when the form is "reActivated". I'm trying to use "datagrid.rebind" command to refresh the datagrid,but nothing happens.I'll have to unload and load the form again to display fresh data on the datagrid, but i know there is a right way to do this.Can somebody please tell me how?

Datagrid And Extern Data Display
I've a datagrid and i want
to display Column 7 in a textbox
if row is changed

and if the textbox changes
i want to save it into the
datagrid

my datagrid is bound on a recordset

how could i do this?

Datagrid To Display Data From Two Tables
Hi,

I am trying to display data from two tables in the one datagrid using an ado data control. The first table is expenses and the second is rates and they are joined by rateid. The trouble is I wasnt to show expenses for just one employee..

Having major difficulty. Any help would be appreciated.

Display Data From Datagrid To Textbox
i want to know on how can i simply display the data in datagrid in the textbox.for example the user will click on one item in the datagrid and then all the data from the row will be displayed in each of the textbox that i've assign for each of the fields in the recordset.help me..tq

Datagrid Doesn't Display Data
Hi there,
I tried to use a datagrid control is to display some
records retrieved from a table but couldn't get it
done.
stmt = "Select itemName, quantityAvailable from
inventory"
set rs = new recordset
rs.open stmt, activeConn,........
datagrid1.dataSource = rs
with rs
if .RecordCount > 0 then
.movefirst
end if
............
In the debugging window, I could see that 16 records
were retrieved but datagrid1 didn't display any data.
Why? And can data be displayed? Anyone has any idea?
Please help.

Jeremy

Determining Data To Display In A DataGrid (VB6)
Hi guys,
i've now got a datagrid which i need to populate with records from a mdb table depending on what is selected in two combo boxes.

I have two combo boxes which display date from and date to and i need some code that puts records into the datagrid between the two dates selected in the combo boxes....so if anyone could help out , i'd be grately appreciative.


Datagrid Display Incorrect Data
I'm stock when my datagrid display only check boxes instead of texts in the datagrid cells. Below are my code that I use to populate the datagrid.

Code:Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:VB ProjectFormPracticeLoginScholarship.mdb"
        Dim strPerSQL As String = "SELECT Personal.SSN, Personal.FstName, Personal.MdlName, Personal.LstName, Education.Status, Education.Rank FROM Personal, Education WHERE Personal.SSN=Education.SSN"
        perDataAdapter = New OleDbDataAdapter(strPerSQL, strConn)
 
        perDataSet.Clear()
        perDataAdapter.Fill(perDataSet, "Personal")

        Dim ts As New DataGridTableStyle()
        dgApplicants.SetDataBinding(perDataSet, "Personal")
        ts.MappingName = "Personal"
        Dim dtColSSN As New DataGridBoolColumn()
        dtColSSN.HeaderText = "SSN"
        dtColSSN.MappingName = "SSN"
        dtColSSN.ReadOnly = True
        Dim dtColFstName As New DataGridBoolColumn()
        dtColFstName.HeaderText = "First Name"
        dtColFstName.MappingName = "FstName"
        dtColFstName.ReadOnly = True
        Dim dtColMdlName As New DataGridBoolColumn()
        dtColMdlName.HeaderText = "Middle Name"
        dtColMdlName.MappingName = "MdlName"
        dtColMdlName.ReadOnly = True
        Dim dtColLstName As New DataGridBoolColumn()
        dtColLstName.HeaderText = "Last Name"
        dtColLstName.MappingName = "LstName"
        dtColLstName.ReadOnly = True
        Dim dtColStatus As New DataGridBoolColumn()
        dtColStatus.HeaderText = "Standing"
        dtColStatus.MappingName = "Status"
        dtColStatus.ReadOnly = True
        Dim dtColRank As New DataGridBoolColumn()
        dtColRank.HeaderText = "Rank"
        dtColRank.MappingName = "Rank"
        ts.GridColumnStyles.Add(dtColSSN)
        ts.GridColumnStyles.Add(dtColFstName)
        ts.GridColumnStyles.Add(dtColMdlName)
        ts.GridColumnStyles.Add(dtColLstName)
        ts.GridColumnStyles.Add(dtColStatus)
        ts.GridColumnStyles.Add(dtColRank)
        dgApplicants.TableStyles.Add(ts)

        dgApplicants.DataSource = perDataSet.Tables!Personal

Please help.

Thanks!

Chong

Database Display Using DataGrid Control
I have made a Table using Access and I use VB to display the content of my Table using ADO and DataGrid Control.

My problem is that one of the field in the Table is a Date Field which I format it in Access as Medium Date but when I displayed it in DataGrid Control it is displayed as "1/2/2005".

How can I displayed it in DataGrid Control as "Dec-01-2005"?

One more thing I want to use the set database password and Is their a possiblity that my VB Appz can change the database password on run-time?

Need your help and suggestion.

Thank u.

How To Display A Table In DataGrid Control
hi vbforums members...

im a beginner in Visual Basic. can someone tell how to use datagrid control to display a table in it....

im using MS Access 2003 as back-end and VB 6.0 as front-end.

How To Display The Data Inputted From A Textbox To The Datagrid?
I'm using vb6. and i'm just wondering how to make changes in a datagrid without binding it to a datasource.


(Moved from VB.NET Forum to VB General Forum - CanOz)



Edited by - pelipe_H on 1/22/2005 1:25:20 AM

Open .csv File And Display All The Data Inside To Datagrid?
hi
what i want to do is i open .csv file and display all the data inside that .csv file to datagrid and refresh the datagrid everytime that .csv file data inside modify?

the problem i face it now display it to datagrid and refresh it?
open file it's ok for me.


thanx a lot.

How To Display Selected Data From Excel To VB(Flexigrid Or Datagrid)
Hi

Can somebody please help me.

I would like to select a range of data from an Excel spreadsheet and display the selected data in either a flexigrid or datagrid in VB. The problem is I don't know how.


Thank you in advance for your responses.

Kind regards

Happy

Display A Form Control's Text/caption To A Data Report Control
Hi to all!!!

Any idea on how to display a form control's text property/caption to a data report control?

Say, I have a form(frmProcessCustomer) that accepts a customer name in a textbox.Then I would like to display the customer name from the textbox(.text property) to my data report using rpttextbox/rptlabel when I view the report...

Data Control Display?
I have just learned how to use a data control to change info for my football pool program. Primarily the weekly schedule of games, yet I don't know how toomake the controls' text display the week # that i've switched to. I would like it to display "'Week 2" when I change to that week. What am I missing here?

Data Display In The DataReport Control
Hi,

I have a DataReport control that I use to show certain records on a Recordset, which has a field with boolean (true-false) values. On a regular Access database, this would be -1's and 0's. So what I need to do is not to show the -1 and 0's but to show something instead of that. I mean, something like "This is true" instead of -1 and "This is false" instead of 0. How can I do this?

Thanks,
- Lucas

Data Display Using Control Array
Hi All,

I have a backend Access 2000 database. The front end is in Visual Basic 6.0.
Using a standard form I have retrieved records from the access database based on a specified condition. The data retrieved is displayed in the form using control arrays ( mainly labels ). But the problem is that some part of the data which does not fit in the form is not displayed.

Can the above problem be solved using vertical scrollbars? Please do not suggest using data reports because my requirement is using a form.

Any help in this regard will be highly appreciated.

Thanxs in advance.

Simple Data Display Control?
Iím trying to coerce the DataGrid control into displaying output from my application Ė there are no databases involved; I just want to display (8) columns of output with headers in an orderly fashion so that it can be viewed and printed. Is there an MS control thatíll do it simply? The help system is, as usual, as helpful as the proverbial chocolate teapot - or perhaps I'm just too thick to ask the right questions .....

Dave

What Control To Display Data As A Report ?
I need to display data from database like a report but I don't know what control is the most useful ? If I use MSFlexGrid, how to insert data after select from database ? Thanks for help.

Data Control To Display Only Certain Records
i have a subroutine that prompts the user for a case number; if they type in 000000 i need all the cases w/ 000000 to show up in the form and the user can click the arrow on the databound control to go through only the records with a case number of 000000

also how could i show all these records using a grid; i need a number they input to pull up a grid w/ all the records relating to that inputted number; like the 000000. So every case number w/ 000000 would appear in the grid. It needs to be exchangeable though depending on what number is entered by the user.

Need serious help!!!!

Thanks

Display Of Tabular Data--Control Needed.
Hi,
I am trying to display a set of tabular data which sometimes can
run long.At present I use Heirarchial Flex Grid and it does not
provide a gud User Interface and the readability is poor.I am
thinking of displayin them in a HTML page in the VB application
itself with some good GUI(Say like hyperlinks, etc.).So please
suggest a method to acheive the same ASAP.
Thanks in Advance.

Huge Data Display In Listview Control
In my project there is a situation where in i may have to display one lakh to 10 lakh records in listview control.the code i have written takes 5 min to display the one lakh records but the problem the form that has the listview control appears as though it is hung and user cannot do anything on the form.
So i want to display the data in chunks so that the system is not hung and user can actually start seeing the records that are fetched and scroll.(similar to find files dialog where in if some files are found it keeps on displaying and still the search is on and i can still scroll top and bottom)

if anyone can help me i would be glad

Can Data List Control Display More Than One Field?
I currently have a data list control that is bound to a table in my access database. It displays one field for each row in the table. I would like to display two fields of each row. Can a data list control display more than one field in each list item or do I have to retrieve each row and create my own list?

Thanks,
Tracy

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 & ADo Data Control
I have a lookup window that uses datagrid and ADO data control as the data source. After compiling my application that uses this lookup, and deploy it to the target machine, the lookup window on popup does not display data.

However, when i installed VB6 Disk 1 on the target machine and run my application, the lookup window works.

pls how can i figure out the missing file in my application?

thanks

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...

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.

DAta Grid Using Adodc Control Doesn't Display Sorted Record Why?
Please Help me any coding suggestions...I have a datagrid using AdodcControl as a datasource cant display sorted record but instead the record is jumbled every time I load the form...I have tried using an SQL statement with Order BY [FIELD] ASC but still it wont work...Please can somebody help me about this problem...Thanks...

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 ...?

Click Datagrid Row And Display Details To Another Datagrid
hello there..here i need help. i have a datagrid that retrieve data from database.what i want to do with the datagrid is when i click any rows of the datagrid it can display the details of the data (refer to the row that i click) to another datagrid.

is there possible to be done ?

i want to know if there is any procedure that can capture the datagrid row that i clicked

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