Solved

datagrid control 6.0

Posted on 2001-06-26
7
180 Views
Last Modified: 2010-05-02
Hi
 Can someone please help me out with this problem.
It is like this.
I am using ado data control to link a datagrid control to a ms access database table.
How can I do it by only using code and not ado data control. It should be like this
1) In the beginning it should be blank to allow the user to input data
2) Then the user can click on a command button to save data to the table in the database
3)Then the user can use one of the fields(maybe primary key) to retrieve the data and display it on the datagrid.
But it should be by using only code not ado data control

thanks

0
Comment
Question by:bimalprakashsharma
7 Comments
 
LVL 4

Expert Comment

by:TomLaw1999
ID: 6228993
The bast way to learn database programming is by example and Microsoft has provided a data programming generator in VB6 that explains what to do.

1) Click on add-ins
2) Select add-in manager
3) Select VB6 data form wizard.

A coded ADO program complete with data control can be generated very quickly and easily.

p.s. Just in case the add-in is not available on your version the code you require is available from the microsoft site www.microsoft.com and there are a number of excellent examples on www.planetsourcecode.com.

Best of luck with your project.
0
 

Expert Comment

by:bppraveen001
ID: 6230924
Hello bimalprakashsharma,

1) Add DataGrid component to your project (by using Project -> Components) and add it to the form where you want(also add other components that you want for the form).
2) Take reference to Microsoft ActiveX Data Objects 2.5 (ADO 2.5) to the project.
3) After the user entered the details and when he clicks on the Submit button take the connection to Database and store the information in the table (by using either ADODB.Command or ADODB.Recordset object or if you have any stored procedure which does the work of storing the values into database(table) ) after that execute one select state like :
  Select Field from table
and execute the statement. If there are any recrods in the table  ADODB.Recordset object will contain the result set then you issue the following command :
  Set DataGrid1.DataSource=objRecordSet
  DataGrid1.Refresh
This will store the resultset values.

After this you write the code in on click of the DataGrid and findout on which row user has clicked then take the value of the corresponding row and do the remaining task that you want to do.

bpp
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6231460
bppraveen001, you are not new to this site so should be familiar with the protocol. It is not good practice to lock questions in this way by using the "answer" option. Please read the guidelines on comments vs answers at the bottom of this page.

bimalprakashsharma: Please close out the ungraded thread http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20085950 you are still active on this site and a failure to maintain your questions is sufficient grounds for suspension of your account.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:bimalprakashsharma
ID: 6232826
I cannot enter anything into the datagrid control unless I bind it to ADO data control. Even if I set the allow add new to true..............
0
 
LVL 4

Accepted Solution

by:
TomLaw1999 earned 200 total points
ID: 6232950
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6710106
Please update and finalize ALL your open questions at this site.  Site Guidelines and Member Agreement as well as details on the Question/Answer process are available from the HELP DESK link on the left.

Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6724216
bimalprakashsharma ----->  You last logged on 01/07/02, and have open questions you have not updated/finalized, some of which date back to early last year.

PLEASE UPDATE ALL YOUR OPEN QUESTIONS and add comments if more is needed, and award the experts who have helped you to close them.

If you need help in splitting points or for other actions, please comment and I will respond as quickly as I can.

I am adding this to all your open questions to make it easier for you to find them and update them.

Thank you,

Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now