Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

datagrid control 6.0

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
bimalprakashsharma
Asked:
bimalprakashsharma
1 Solution
 
TomLaw1999Commented:
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
 
bppraveen001Commented:
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
 
TimCotteeCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
bimalprakashsharmaAuthor Commented:
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
 
TomLaw1999Commented:
0
 
MoondancerCommented:
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
 
MoondancerCommented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now