Solved

datagrid control 6.0

Posted on 2001-06-26
7
182 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 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