Vb6 access database8/6/2023 ![]() 4) Let us have two hypothetical situations (a) where we are avoiding permanent connections to the DB (b) where we want to allow a permanent connection to the DB, since I would like to know the differences between the two. To answer your questions: 1) I am using the Data Control. EG - txtName = rs!Name etc If you are using a grid (eg flexgrid), you can again use code to load the data into the rows/cells. Thus in Allen's example, where he has Debug.Print, is the spot where you use the field values and place them into controls vis code. If you avoid the Data Control, you should also avoid 'binding' A rs can be bound to controls, but you won't find many professionals using 'binding'. What you may not be realizing, is you should also not be using 'binding' I am assuming that your working project is displaying data because the Data Control is bound to some controls on your Form. The advice about not using the Data Control is VERY good advice. Microsoft must think binding is OK.consider the impact on Microsoft Access were binding a bad thing.įrom: Fri, 10:37:11 +0000Subject: RE: Connecting Access Database in Vb6.0 Might I ask your rationale for suggesting that binding is evil? (Not to worry - after 30 years in the technology game I don't much care what anybody says about my professionalism, 'n I have the requisite university degrees for those who get fussy about that illusory means of qualification.) Hmmm.although I avoid the data control kludge, I use binding all of the time. To connect to the database through VB6.0 code using sql. The data displays on the form when the programm runs. I know how to connect this database to vb6.0 form, so that "Personnel" with the following tables, state, local/governments and Subject: Connecting Access Database in Vb6.0 Subject: RE: Connecting Access Database in Vb6.0 Thanks Allen for your assistance, and particularly for the advice to stay away from ADO Data Control.Ĭould you please tell me the best alternative to ADODC and how to apply it to achieve the objective stated ealier? 'The last part (& "") will account for nullsĭebug.print rs.Fields("Field2").Value & ""ĭebug.print rs.Fields("Field3").Value & "" Rs.Open sql, cn, adOpenForwardOnly, adLockReadOnlyĭebug.print rs.Fields("Field1").Value & "" ![]() Sql = "Select Field1, Field2, Field3 from TableName where Field1 = Info=True User ID=USERID Initial Catalog=DATABASE_NAME Data ![]() 'Of course, change the Password, User ID, Initial Catalog, and SourceĬn.Open "Provider=SQLOLEDB.1 Password=PASSWORD Persist Security 'Include a reference to "Microsoft ActiveX Data Objects 2.x" Here's how to use ADO to accomplish what you want. ![]() I inherited a program with no less than 100ĪDODCs in it, and I still curse the person who originally created it. Once your program gets larger, you will end up with a bunch of themĪnd they are always open. Do yourself a favor and stay away from the ADO Data Control. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |