From bkollodge at parkindustries.com Thu Jul 14 13:52:32 2005 From: bkollodge at parkindustries.com (Bill Kollodge) Date: Thu, 14 Jul 2005 13:52:32 -0500 Subject: [dba-VB] VB to VB via Ethernet Message-ID: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Hi folks, can anyone offer me direction or suggestions on how to enable 2 computers, each running their own VB application, to communicate to each other via Ethernet? I need to have one automated machine notify another when it is complete (or some other event happens). The machines run VB apps. Not sure where to even start. Any help/experience is greatly appreciated. Thanks, Bill Kollodge Software Engineering / CNC Products Park Industries St. Cloud, MN 56303 bkollodge at parkindustries.com This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. From sgsax at ksu.edu Thu Jul 14 14:12:34 2005 From: sgsax at ksu.edu (Seth Galitzer) Date: Thu, 14 Jul 2005 14:12:34 -0500 Subject: [dba-VB] VB to VB via Ethernet In-Reply-To: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> References: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Message-ID: <42D6B922.4010604@ksu.edu> Bill, As always, there are several ways to do this. I can think of two. 1) Write a TCP/IP client/server app. There are many examples for this on the web. You want to search for examples of using Windows Sockets in VB. With this method, you would write a server app which would listen on a port for a message from the client (which you would also write an app for). This message could be anything, from just a "done" message, to a periodic "status" message. 2) Create a shared directory on the "server" machine. On the "client" machine, when it finishes its task, write to a file on the server's shared directory, either using the full UNC path or map a drive letter to the location on the server. On the server, write an app that looks in that directory for the existence of this file. You can either read from the file, or just check to see if it exists. Once you've determined the status, either delete the file or reset its contents using the server app. Of these two methods, 2) would probably be easier, since it's only using built-in file and directory I/O methods and would require no new programming skills (like using Windows Sockets), but 1) would be more fun, as you would get to learn new programming skills (like using Windows Sockets). Seth Bill Kollodge wrote: > Hi folks, can anyone offer me direction or suggestions on how to enable > 2 computers, each running their own VB application, to communicate to > each other via Ethernet? > > I need to have one automated machine notify another when it is complete > (or some other event happens). The machines run VB apps. Not sure > where to even start. Any help/experience is greatly appreciated. > > Thanks, > > Bill Kollodge > Software Engineering / CNC Products > Park Industries > St. Cloud, MN 56303 > bkollodge at parkindustries.com > > > > This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From jwcolby at colbyconsulting.com Thu Jul 21 13:50:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Thu, 21 Jul 2005 14:50:00 -0400 Subject: [dba-VB] VBExpress videos Message-ID: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From accessd at shaw.ca Thu Jul 21 14:02:12 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 21 Jul 2005 12:02:12 -0700 Subject: [dba-VB] VBExpress videos In-Reply-To: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> Message-ID: <0IJZ00C18RJK5W@l-daemon> Thanks for the info. John -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Thursday, July 21, 2005 11:50 AM To: VBA; AccessD Subject: [dba-VB] VBExpress videos In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 06:27:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 07:27:15 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <0IJZ00C18RJK5W@l-daemon> Message-ID: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jdemarco at hudsonhealthplan.org Fri Jul 22 06:53:43 2005 From: Jdemarco at hudsonhealthplan.org (Jim DeMarco) Date: Fri, 22 Jul 2005 07:53:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <08F823FD83787D4BA0B99CA580AD3C74016C3BA3@TTNEXCHCL2.hshhp.com> John, I don't have an example handy at the moment but I believe you can walk the records in a given table in a Dataset object. I may have something here to show you if I get a chance to look around later. Jim DeMarco -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". *********************************************************************************** From mikedorism at verizon.net Fri Jul 22 07:10:43 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 08:10:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> Message-ID: <000001c58eb6$63215c90$2f01a8c0@dorismanning> In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 07:30:48 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 08:30:48 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000001c58eb6$63215c90$2f01a8c0@dorismanning> Message-ID: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:07:40 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:07:40 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Message-ID: <000101c58ebe$57b75410$2f01a8c0@dorismanning> The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 08:08:33 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 14:08:33 +0100 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <200507221259.j6MCx6r13571@smarthost.yourcomms.net> Hi With a dataset you can do this Dim drows() as datarow = ds.tables(0).Select("ClientID = " & intID) to find a specific record Then can use drows.count or For each dRow in drows '' do something Next Both datareaders and datasets allow field references dr("ClientID") and ds("ClientID") Hope this helps Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 13:31 To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 08:24:37 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 09:24:37 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000101c58ebe$57b75410$2f01a8c0@dorismanning> Message-ID: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:34:35 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:34:35 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> Message-ID: <000201c58ec2$1a921cb0$2f01a8c0@dorismanning> I know what you mean. I had to piece it all out the hard way just like you are. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 9:25 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:54:28 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:54:28 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, I think what you are looking for is a filter. Google 'ado recordset filter' Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:57:34 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:57:34 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:04:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:04:00 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001901c58ec6$35ad3620$6c7aa8c0@ColbyM6805> Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:14:24 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:14:24 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From marcus at tsstech.com Fri Jul 22 09:18:42 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:18:42 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: This website gives an overview of ADO.Net and vb.net. http://www.programmersheaven.com/articles/patrik/Hierarchical.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:21:43 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:21:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:37:59 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:37:59 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, Also have a look at DataViews. Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 10:02:39 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 11:02:39 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Bear in mind that I could have called the Reader object 'rst'(or any valid variable name, Reader is not a reserved word) and the code would be exactly the same. That's why it was a little confusing what you were asking. Plus I jumped in the middle of the thread. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:22 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 10:23:38 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 11:23:38 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> Message-ID: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From mikedorism at verizon.net Fri Jul 22 10:35:11 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 11:35:11 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 11:09:18 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 17:09:18 +0100 Subject: [dba-VB] Add executable solution to project Message-ID: <200507221559.j6MFxor27655@smarthost.yourcomms.net> Hi I think if you add the project (which contains the code in the dll) to your solution you can then debug the dll code - you can then set a reference in your main project/solution to reference that project (as opposed to the dll) HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 16:24 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:24:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:24:15 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Message-ID: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 11:35:14 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 12:35:14 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> Message-ID: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:45:19 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:45:19 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Message-ID: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Yes, but as soon as I do that, then I am right back to the "namespace system.data cannot be found". For some reason, the namespaces I use in that class library are valid in a "class library" but are not valid in a "Windows Application". John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 12:35 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 06:42:53 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 07:42:53 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Message-ID: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:14:49 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:14:49 -0400 Subject: [dba-VB] .net correct version of jet Message-ID: <000d01c59049$49ec9160$6c7aa8c0@ColbyM6805> I am using the following code to set up a connection. Public Sub New(ByVal lstrMDBFileSpec As String, ByVal lstrTblName As String) Dim mstrCnnJet As String = "Provider=Microsoft.Jet.OLEDB.4.0;" mstrCnn = mstrCnnJet & lstrMDBFileSpec mstrTblName = lstrTblName LoadSysVars(mstrCnn) End Sub The code passes in a filespec for an MDB container that a table resides in and the table name. Inside new() the mstrcnn is built up by appending mstrCnnJet and lstrMDBFileSpec. This works but it seems that I am getting awfully specific in mstrCnnJet. Is there a way to determine what version of Microsoft.Jet.OLEDB is available on the machine that the code is running on? Or is this a non-issue as there is only (and will only ever be) one version (4.0)? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:36:36 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:36:36 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000e01c5904c$552c5490$6c7aa8c0@ColbyM6805> Well... This was all caused by a lack of understanding of imports and references. I just needed to reference the right object (namespace?). I still haven't gotten back to this point but I do have all of my collection and oledb code working. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 08:55:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 09:55:25 -0400 Subject: [dba-VB] Connection strings for ado Message-ID: <000f01c59057$5abb3560$6c7aa8c0@ColbyM6805> I found this: http://www.connectionstrings.com/ John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 09:36:03 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 10:36:03 -0400 Subject: [dba-VB] .Net Strategies for classes connecting to data Message-ID: <000001c5905d$083c3950$6c7aa8c0@ColbyM6805> I have designed a class system for my Sysvars. I have it working for connecting to data in MDB files, however I am now looking to make it general enough to load data out of different types of data stores. Should I: 1) Just require the class user (programmer) to build their connection string, accept the connection string and load the data. 2) Overload the new() constructor to allow different methods where I build up the connection strings based on passed in pieces. 3) Allow the programmer to inherit the class and build a new() that does that final piece however they want. I want the class to be "just usable" with an Access BE (for my own purposes). OTOH, I also want to be able to use the class for connecting to SQL Server or XML files (specifically) without too much bother. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From ebarro at afsweb.com Sun Jul 24 11:12:20 2005 From: ebarro at afsweb.com (Eric Barro) Date: Sun, 24 Jul 2005 09:12:20 -0700 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> Message-ID: John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. From jwcolby at colbyconsulting.com Sun Jul 24 11:40:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 12:40:25 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000101c5906e$679c0e50$6c7aa8c0@ColbyM6805> Thanks for that tip. I'll start doing it that way. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Sun Jul 24 13:29:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Sun, 24 Jul 2005 14:29:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000001c5907d$952be200$2e01a8c0@dorismanning> In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 19:45:41 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 20:45:41 -0400 Subject: [dba-VB] XML Serialization Message-ID: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Well I made my base SysVar structure serializable and created a SerializeOut and SerializeIn in the SysVar collection class and voila, exports / imports of sysvars to XML files. Cool stuff. This means that I can now store SysVars in either an MDB or XML files. It "only" took FOUR days to figure all this stuff out starting with working VBA ADO classes in Access. One more class and I will have the full SysVar functionality that I had inside of VBA. The upside though is that learning how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation (and working examples) for much of the data manipulation stuff that I "just knew how to do" in VBA. So many properties/methods, so little time. And serialization to/from XML is pretty darned cool as well. I've only scratched the surface on that stuff. I must say I don't know what I would do without the internet though. I own one pretty good VB.Net book and three different ADO.Net books ad it is still waaaay faster to just Google for example code. Once I have working example code it is easy enough to pick up and understand what is going on. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 20:16:57 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 21:16:57 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000001c5907d$952be200$2e01a8c0@dorismanning> Message-ID: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. From mikedorism at verizon.net Mon Jul 25 08:50:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Mon, 25 Jul 2005 09:50:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Message-ID: <000501c5911f$c4fbd7e0$2e01a8c0@dorismanning> John, This website has a lot of really good tutorials. Take a look at #6 for info on structures. You can definitely do what you are trying to with a structure. http://www.programmersheaven.com/2/VB-NET-School Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 9:17 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Mon Jul 25 11:48:20 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Mon, 25 Jul 2005 09:48:20 -0700 Subject: [dba-VB] XML Serialization References: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Message-ID: <42E517D4.5020008@shaw.ca> I don't know if you are using ado streams to ouput or input an ado recordset as an xml file but here is some really rough test code I was running from Access97. I was using to debug Google's desktop search engines output of UTF-8 xml via Access There is code here to check the proper BOM marker on XML and also convert the output xml from the ado stream to different encoding types UTF-8, Unicode, ISO-8859-1, Big-5 etc. I also use this method to convert xml files to and fro from UTF-8 to UTF-16 encoding. UTF-8 being a mangled compression of UTF-16 with one caveat if the original xml characters aren't properly escaped such as Windows typographical chars they will be dropped by the conversion. This is a problem with the XML google pumps out. especially with international chars. Maybe there are enough notes to puzzle it out or give you somethings to consider. Sub ReadFileInUTF16() '1 LoadFromFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" MsgBox stm.ReadText End Sub Sub SaveFileinUTF8() '2 SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub ReadSaveFileInUTF8() '1/2 ReadToFile / SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub TranlateToUTF8() '3 charset snippet 'ERROR Don't Use this code, just to expose the google error Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" stm.Charset = "UTF-8" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub PersistStreamToXML() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set cnn = New ADODB.Connection cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & CurrentDb.Name & ";" Set rst = New ADODB.Recordset rst.Open "SELECT * FROM tblTest", cnn Set stm = New ADODB.stream rst.Save stm, adPersistXML rst.Close Set rst = Nothing MsgBox stm.Charset stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite Set stm = Nothing End Sub Sub ReadUTF8SaveFileInUTF16test() '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx Dim stm As ADODB.stream Dim strPath As String Dim strData As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.Position = 0 stm.Type = adTypeText 'stm.LoadFromFile strPath & "encUTF8.xml" stm.LoadFromFile "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml" ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 strData = stm.ReadText() Debug.Print strData stm.Position = 0 stm.Charset = "Unicode" ' "Unicode" '"ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strPath & "test16.xml", adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml", ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\XM8_UTF_vb.xml","C:\XML\Gil Encodings\test16.xml" Sub ReadUTF8SaveFileInUTF16(strFileIn As String, strFileOut As String) '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx 'used ado 2.7 Dim stm As ADODB.stream Dim strPath As String Dim strData As String 'the character set encoding names for the machine are in the registry 'For a list of the character set strings that is known by a system, see 'the subkeys of HKEY_CLASSES_ROOT\MIME\Database\Charset 'in the Windows Registry. Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" 'input file character set stm.Position = 0 stm.Type = adTypeText ' stm.LoadFromFile strFileIn ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 'reset to beginning of stream Dim strDataout strData = stm.ReadText() ' line below used to change encoding instruction for xml files ' 'strData = Replace(strData, "utf-8", "UTF-16", 1, 1) strData = Replace(strData, "utf-8", "UTF-16", 1, 1) Debug.Print strData stm.Position = 0 ' set output file character set stm.Charset = "UTF-16" ' "Unicode" '"iso-8859-1" "ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strFileOut, adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub Public Function Replace(strIn As Variant, strFind As String, _ strReplace As String, Optional intStart As Integer = 1, _ Optional intCount As Integer = -1, _ Optional intCompare As Integer = 0) As String '----------------------------------------------------------- ' Inputs: String to search and replace, ' search string, replacement string, ' optional starting position (default = 1), ' optional replacement limit (default = -1 .. ALL) ' optional string compare value (default = 0 .. vbBinaryCompare) ' Outputs: Replaced string ' Created By: JLV 09/05/01 ' Last Revised: JLV 09/05/01 ' ** Duplicates the functionality of the VB 6 REPLACE function. '----------------------------------------------------------- Dim strWork As String, intS As Integer, intCnt As Integer Dim intI As Integer, intLenF As Integer, intLenR As Integer If (intCompare < 0) Or (intCompare > 2) Then Err.Raise 5 Exit Function End If If VarType(strIn) <> vbString Then Err.Raise 5 Exit Function End If strWork = strIn intS = intStart intCnt = intCount intLenF = Len(strFind) intLenR = Len(strReplace) ' If find string zero length or count is zero, then nothing to replace If (intLenF = 0) Or (intCnt = 0) Then Replace = strIn Exit Function End If ' If start beyond length of string, return empty string If intS > Len(strWork) Then Replace = "" Exit Function End If ' Got some work to do -- find strings to replace Do intI = InStr(intS, strWork, strFind, intCompare) If intI = 0 Then Exit Do ' Insert the replace string strWork = Left(strWork, intI - 1) & strReplace & Mid(strWork, intI + intLenF) intS = intS + intI + intLenR - 1 ' Bump start to end of the replace string intCnt = intCnt - 1 ' Decrement the max replace counter Loop Until intCnt = 0 Replace = strWork End Function Public Function GetPath(ByVal strFilePath As String) As String Dim s As String Dim i As Integer For i = Len(strFilePath) To 1 Step -1 s = Mid$(strFilePath, i, 1) If StrComp(s, "\", vbBinaryCompare) = 0 Then GetPath = Left$(strFilePath, i) Exit For End If Next End Function Sub CheckBOM(Optional strFileIn As Variant, Optional strIn As Variant) 'checkbom "C:\XML\Gil Encodings\encUTF8_NoDecl.xml" On Error GoTo Err_handler Dim strInputData As String * 4 Dim lpBuffer() As Byte Dim intFreeFile As Integer If Not IsMissing(strFileIn) Then intFreeFile = FreeFile Open strFileIn For Binary Access Read Lock Read As #intFreeFile Len = 4 ReDim lpBuffer(4) Get #intFreeFile, , lpBuffer Close #intFreeFile ElseIf Not IsMissing(strIn) Then 'Can't makes this work since VBA is always converting the string to UTF-16LE lpBuffer = Left$(strIn, 4) Else MsgBox "Nothing To Do" Exit Sub End If If lpBuffer(0) = 255 And lpBuffer(1) = 254 Then Debug.Print "File is UTF-16 Little Endian" ElseIf lpBuffer(0) = 254 And lpBuffer(1) = 255 Then Debug.Print "File is UTF-16 Big Endian" ElseIf lpBuffer(0) = 239 And lpBuffer(1) = 187 And lpBuffer(2) = 191 Then Debug.Print "File is UTF-8" 'Start trying to figure out by other means this will only work on xml files that start with "= 128 And lngUCS_dec < 2048 Then bytOne = 192 + (lngUCS_dec \ 64) bytTwo = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo)) ElseIf lngUCS_dec >= 2048 And lngUCS_dec < 65536 Then bytOne = 224 + (lngUCS_dec \ 4096) bytTwo = 128 + ((lngUCS_dec \ 64) Mod 64) bytThree = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo) & Hex(bytThree)) Else MsgBox "Character Out of Range" End If End Function John W. Colby wrote: >Well I made my base SysVar structure serializable and created a SerializeOut >and SerializeIn in the SysVar collection class and voila, exports / imports >of sysvars to XML files. Cool stuff. This means that I can now store >SysVars in either an MDB or XML files. > >It "only" took FOUR days to figure all this stuff out starting with working >VBA ADO classes in Access. One more class and I will have the full SysVar >functionality that I had inside of VBA. The upside though is that learning >how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation >(and working examples) for much of the data manipulation stuff that I "just >knew how to do" in VBA. So many properties/methods, so little time. And >serialization to/from XML is pretty darned cool as well. I've only >scratched the surface on that stuff. > >I must say I don't know what I would do without the internet though. I own >one pretty good VB.Net book and three different ADO.Net books ad it is still >waaaay faster to just Google for example code. Once I have working example >code it is easy enough to pick up and understand what is going on. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Mon Jul 25 18:17:45 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Mon, 25 Jul 2005 19:17:45 -0400 Subject: [dba-VB] Inheriting collections Message-ID: <000101c5916f$10e38230$6c7aa8c0@ColbyM6805> Being new to this inheritance thing (in the last 15 years), I have a conceptual question: In my SysVarRec I use a data class (or structure) that holds one record's worth of SysVar data from a specific table. I use a SysVarsTbl class that holds a collection of SysVarRec instances. This class loads all of the sysvar records from a single table, loading each record's data into a SysVarRec class or structure. I use a SysVars class which loads one or more instances of SysVarsTbl, storing each SysVarsTbl class into a collection. ADDITIONALLY, this class then merges all of the SysVarsTbl class' data into a single collection of SysVars. This collection is nothing more than a keyed collection, where the value is stored, with a key to index into the collection. The objective here is to allow several different copies of a SysVars table to exist, where the "last loaded wins". For example, suppose I have a SysVar called EnableZip, whose value is True/False. If True the Zip functionality is loaded as the framework sets up. In the framework's copy of tblSysVars, EnableZip exists but is set to false. Thus as the framework initializes, the zip functionality is not loaded. In the application's copy of tblSysVars, EnableZip is True because this application needs to zip files. The tables load Framework.tblSysVar and then Application.tblSysVars. EnableZip=false loads from the framework table, but then the EnableZip=True loads from the application table loads and "overrides" the framework's SysVar. What really happens is that the EnableZip is found already loaded and changed from False to True. Thus by the time the application table finishes loading, EnableZip is True and the zip functionality of the framework loads. Well, you get the idea anyway. Think up your own scenario. The question now is... Since a class can be inherited, should SysVarsTbl inherit the collection class so that all of the collection functionality is native to the SysVarsTbl class? Or should the SysVarsTbl class simply have a collection class variable that it sets up and loads an instance of the collection class? IOW, SysVarsTbl needs a collection but it could BE a collection or it could just dim and use a collection. VBA did not have this ability, so I became accustomed to just "consuming" collections, i.e. using them. But now the class that needs a collection could BE a collection class, with all of the functionality of the collection class inherited right in and specific non-collection functionality added to it (loading records out of a table for example). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jeff at outbaktech.com Tue Jul 26 15:58:48 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 15:58:48 -0500 Subject: [dba-VB] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com From Jeff at outbaktech.com Tue Jul 26 21:27:15 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 21:27:15 -0500 Subject: [dba-VB] RE: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Sorry, I should have been more specific. I was contacted by a recruiter who is looking for a .NET developer looking for a long term contract in Neenah, WI. The company is looking for 10 years experience in IT and at least 2 years experience with .NET. I was told that they are willing to relax their requirements a little for a 'local boy (or girl). If anyone is interested, please contact me off-list and I will send additional information, including the recruiters name and contact information. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com -----Original Message----- From: dba-ot-bounces at databaseadvisors.com [mailto:dba-ot-bounces at databaseadvisors.com] On Behalf Of Jeff Barrows Sent: Tuesday, July 26, 2005 3:59 PM To: dba-OT; Dba-Tech; dba-VB; AccessD Subject: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com _______________________________________________ dba-OT mailing list dba-OT at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-ot Website: http://www.databaseadvisors.com From Jeff at outbaktech.com Thu Jul 28 09:37:56 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Thu, 28 Jul 2005 09:37:56 -0500 Subject: [dba-VB] RE: [dba-Tech] RE: [dba-OT] Cross Posted: Looking for a .NET developernear Neenah, WI Message-ID: I have already responded to one individual off-list. If anyone else is interested in additional information, please contact me directly at the email address in my signature. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Phone: 886-5913 Fax: 886-5932 Racine, WI jeff at outbaktech.com From fhtapia at gmail.com Thu Jul 28 16:47:34 2005 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 28 Jul 2005 14:47:34 -0700 Subject: [dba-VB] SoapClient in VBscript Message-ID: I have a webservice which I will need to call fom a vbscript (in the end it will be a sp_OA type call, but for this purpose it's a vbscript... I'm looking at the wsdl file and I choose the "CreateOrder" method but I keep getting invalid parameter settings for it... (WSDL file sample included), my current example soap call looks like this: ---Soap---- Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") SOAPClient.mssoapinit (" http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") sxml = "
FO100 HFO-TEST 9002658 Div Of Test 7858 Thorndike Rd GreensBoro NC 27409 United States Test 8055551234 test 100 TEST9999
14-7068 15 21222
" Result = SOAPClient.CreateOrder(sxml) ---endSoap---- I keep getting this error: Server was unable to process request --->Object reference not set to an instance of an object, any ideas??? -----------wsdl----------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----------end wsdl----------- -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspot.com | Tsql and More... From martyconnelly at shaw.ca Fri Jul 29 00:44:07 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Jul 2005 22:44:07 -0700 Subject: [dba-VB] SoapClient in VBscript References: Message-ID: <42E9C227.3080409@shaw.ca> You might take two approaches to check for errors. 1. Using Access and the webservice wizard, point it at your wsdl and create the class code then move that to your vbscript.and call it. 2. use xmlhttp to fire your xml string at the wsdl and parse the returned xml. I have some basic code lying around to do this from VBA 3 Also check you have a valid wsdl file There are a few few of these validator sites on the web http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway Also for ASP I think it should be which might be why it isn't finding the object Dim oSOAP Set oSOAPClient = Server.CreateObject("MSSOAP.So?apClient30") oSOAPClient.ClientProperty("ServerHT?TPRequest") = True ... blah blah Francisco Tapia wrote: >I have a webservice which I will need to call fom a vbscript (in the end it >will be a sp_OA type call, but for this purpose it's a vbscript... I'm >looking at the wsdl file and I choose the "CreateOrder" method but I keep >getting invalid parameter settings for it... (WSDL file sample included), my >current example soap call looks like this: > >---Soap---- >Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") >SOAPClient.mssoapinit (" >http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") > >sxml = "
FO100 >HFO-TEST 9002658 >Div Of Test 7858 Thorndike Rd > GreensBoro NC 27409 >United States Test >8055551234 test 100 >TEST9999 />
14-7068 >15 21222 >
" > >Result = SOAPClient.CreateOrder(sxml) > >---endSoap---- > >I keep getting this error: Server was unable to process request --->Object >reference not set to an instance of an object, any ideas??? > >-----------wsdl----------------- >- > >- > >- > >- > >- > >- > > > > > >- > >- > >type="tns:WSOrderHeader"/> >type="tns:ArrayOfWSOrderItem"/> > > >- > >- > > > > > > > > > > > > > > > > >type="s:string"/> > > > > > >- > >- > >nillable="true" type="tns:WSOrderItem"/> > > >- > >- > > > > > > >- > >- > >- > >type="tns:CreateOrderResponse"/> > > > >- > >- > > >type="s:string"/> >type="s:string"/> > > > > >- > > > >- > > > >- > >- > > > > > > > >- > >style="document"/> >- > > >- > > > >- > > > > > >- >type="tns:WebServiceOrderHttpGet"> > > >- >type="tns:WebServiceOrderHttpPost"> > > >- > > >- > > > >- >binding="tns:WebServiceOrderHttpGet"> > > >- >binding="tns:WebServiceOrderHttpPost"> > > > > > >----------end wsdl----------- > > > -- Marty Connelly Victoria, B.C. Canada From RRANTHON at sentara.com Fri Jul 29 13:06:33 2005 From: RRANTHON at sentara.com (Randall R Anthony) Date: Fri, 29 Jul 2005 14:06:33 -0400 Subject: [dba-VB] Common Dialogue to Open Files-Search Message-ID: <200507291806.j6TI6nR08115@databaseadvisors.com> Hi listers, Friday pm brain cramp, I can't seem to find the info for using the MS common dialogue control to create the M$ Office Open Files in an Access app I'm working on. Any help would be appreciated. I've used this before but can't find where I put it. Thanks! From martyconnelly at shaw.ca Fri Jul 29 14:40:02 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 29 Jul 2005 12:40:02 -0700 Subject: [dba-VB] Common Dialogue to Open Files-Search References: <200507291806.j6TI6nR08115@databaseadvisors.com> Message-ID: <42EA8612.5030703@shaw.ca> API: Call the standard Windows File Open/Save dialog box http://www.mvps.org/access/api/api0001.htm Or you can use Application.FileDialog in Access XP and higher and do multisect, open or save, however fails with runtimes. Sub test() 'needs reference to MS Office Object library ' No go with Runtime Dim dlgOpen As Object 'FileDialog Set dlgOpen = Application.FileDialog(msoFileDialogOpen) With dlgOpen .InitialFileName = "C:\" .Show End With 'or Dim strfile As String, fdObj As FileDialog Set fdObj = Application.FileDialog(msoFileDialogFilePicker) If fdObj.Show = -1 Then MsgBox fdObj.SelectedItems(1) Else MsgBox "You didn't select a file!" End If Set fdObj = Nothing End Sub Randall R Anthony wrote: >Hi listers, >Friday pm brain cramp, I can't seem to find the info for using the MS >common dialogue control to create the M$ Office Open Files in an Access >app I'm working on. Any help would be appreciated. I've used this >before but can't find where I put it. Thanks! >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From bkollodge at parkindustries.com Thu Jul 14 13:52:32 2005 From: bkollodge at parkindustries.com (Bill Kollodge) Date: Thu, 14 Jul 2005 13:52:32 -0500 Subject: [dba-VB] VB to VB via Ethernet Message-ID: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Hi folks, can anyone offer me direction or suggestions on how to enable 2 computers, each running their own VB application, to communicate to each other via Ethernet? I need to have one automated machine notify another when it is complete (or some other event happens). The machines run VB apps. Not sure where to even start. Any help/experience is greatly appreciated. Thanks, Bill Kollodge Software Engineering / CNC Products Park Industries St. Cloud, MN 56303 bkollodge at parkindustries.com This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. From sgsax at ksu.edu Thu Jul 14 14:12:34 2005 From: sgsax at ksu.edu (Seth Galitzer) Date: Thu, 14 Jul 2005 14:12:34 -0500 Subject: [dba-VB] VB to VB via Ethernet In-Reply-To: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> References: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Message-ID: <42D6B922.4010604@ksu.edu> Bill, As always, there are several ways to do this. I can think of two. 1) Write a TCP/IP client/server app. There are many examples for this on the web. You want to search for examples of using Windows Sockets in VB. With this method, you would write a server app which would listen on a port for a message from the client (which you would also write an app for). This message could be anything, from just a "done" message, to a periodic "status" message. 2) Create a shared directory on the "server" machine. On the "client" machine, when it finishes its task, write to a file on the server's shared directory, either using the full UNC path or map a drive letter to the location on the server. On the server, write an app that looks in that directory for the existence of this file. You can either read from the file, or just check to see if it exists. Once you've determined the status, either delete the file or reset its contents using the server app. Of these two methods, 2) would probably be easier, since it's only using built-in file and directory I/O methods and would require no new programming skills (like using Windows Sockets), but 1) would be more fun, as you would get to learn new programming skills (like using Windows Sockets). Seth Bill Kollodge wrote: > Hi folks, can anyone offer me direction or suggestions on how to enable > 2 computers, each running their own VB application, to communicate to > each other via Ethernet? > > I need to have one automated machine notify another when it is complete > (or some other event happens). The machines run VB apps. Not sure > where to even start. Any help/experience is greatly appreciated. > > Thanks, > > Bill Kollodge > Software Engineering / CNC Products > Park Industries > St. Cloud, MN 56303 > bkollodge at parkindustries.com > > > > This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From jwcolby at colbyconsulting.com Thu Jul 21 13:50:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Thu, 21 Jul 2005 14:50:00 -0400 Subject: [dba-VB] VBExpress videos Message-ID: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From accessd at shaw.ca Thu Jul 21 14:02:12 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 21 Jul 2005 12:02:12 -0700 Subject: [dba-VB] VBExpress videos In-Reply-To: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> Message-ID: <0IJZ00C18RJK5W@l-daemon> Thanks for the info. John -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Thursday, July 21, 2005 11:50 AM To: VBA; AccessD Subject: [dba-VB] VBExpress videos In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 06:27:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 07:27:15 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <0IJZ00C18RJK5W@l-daemon> Message-ID: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jdemarco at hudsonhealthplan.org Fri Jul 22 06:53:43 2005 From: Jdemarco at hudsonhealthplan.org (Jim DeMarco) Date: Fri, 22 Jul 2005 07:53:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <08F823FD83787D4BA0B99CA580AD3C74016C3BA3@TTNEXCHCL2.hshhp.com> John, I don't have an example handy at the moment but I believe you can walk the records in a given table in a Dataset object. I may have something here to show you if I get a chance to look around later. Jim DeMarco -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". *********************************************************************************** From mikedorism at verizon.net Fri Jul 22 07:10:43 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 08:10:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> Message-ID: <000001c58eb6$63215c90$2f01a8c0@dorismanning> In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 07:30:48 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 08:30:48 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000001c58eb6$63215c90$2f01a8c0@dorismanning> Message-ID: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:07:40 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:07:40 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Message-ID: <000101c58ebe$57b75410$2f01a8c0@dorismanning> The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 08:08:33 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 14:08:33 +0100 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <200507221259.j6MCx6r13571@smarthost.yourcomms.net> Hi With a dataset you can do this Dim drows() as datarow = ds.tables(0).Select("ClientID = " & intID) to find a specific record Then can use drows.count or For each dRow in drows '' do something Next Both datareaders and datasets allow field references dr("ClientID") and ds("ClientID") Hope this helps Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 13:31 To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 08:24:37 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 09:24:37 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000101c58ebe$57b75410$2f01a8c0@dorismanning> Message-ID: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:34:35 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:34:35 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> Message-ID: <000201c58ec2$1a921cb0$2f01a8c0@dorismanning> I know what you mean. I had to piece it all out the hard way just like you are. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 9:25 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:54:28 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:54:28 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, I think what you are looking for is a filter. Google 'ado recordset filter' Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:57:34 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:57:34 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:04:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:04:00 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001901c58ec6$35ad3620$6c7aa8c0@ColbyM6805> Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:14:24 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:14:24 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From marcus at tsstech.com Fri Jul 22 09:18:42 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:18:42 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: This website gives an overview of ADO.Net and vb.net. http://www.programmersheaven.com/articles/patrik/Hierarchical.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:21:43 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:21:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:37:59 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:37:59 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, Also have a look at DataViews. Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 10:02:39 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 11:02:39 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Bear in mind that I could have called the Reader object 'rst'(or any valid variable name, Reader is not a reserved word) and the code would be exactly the same. That's why it was a little confusing what you were asking. Plus I jumped in the middle of the thread. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:22 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 10:23:38 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 11:23:38 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> Message-ID: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From mikedorism at verizon.net Fri Jul 22 10:35:11 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 11:35:11 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 11:09:18 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 17:09:18 +0100 Subject: [dba-VB] Add executable solution to project Message-ID: <200507221559.j6MFxor27655@smarthost.yourcomms.net> Hi I think if you add the project (which contains the code in the dll) to your solution you can then debug the dll code - you can then set a reference in your main project/solution to reference that project (as opposed to the dll) HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 16:24 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:24:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:24:15 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Message-ID: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 11:35:14 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 12:35:14 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> Message-ID: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:45:19 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:45:19 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Message-ID: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Yes, but as soon as I do that, then I am right back to the "namespace system.data cannot be found". For some reason, the namespaces I use in that class library are valid in a "class library" but are not valid in a "Windows Application". John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 12:35 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 06:42:53 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 07:42:53 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Message-ID: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:14:49 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:14:49 -0400 Subject: [dba-VB] .net correct version of jet Message-ID: <000d01c59049$49ec9160$6c7aa8c0@ColbyM6805> I am using the following code to set up a connection. Public Sub New(ByVal lstrMDBFileSpec As String, ByVal lstrTblName As String) Dim mstrCnnJet As String = "Provider=Microsoft.Jet.OLEDB.4.0;" mstrCnn = mstrCnnJet & lstrMDBFileSpec mstrTblName = lstrTblName LoadSysVars(mstrCnn) End Sub The code passes in a filespec for an MDB container that a table resides in and the table name. Inside new() the mstrcnn is built up by appending mstrCnnJet and lstrMDBFileSpec. This works but it seems that I am getting awfully specific in mstrCnnJet. Is there a way to determine what version of Microsoft.Jet.OLEDB is available on the machine that the code is running on? Or is this a non-issue as there is only (and will only ever be) one version (4.0)? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:36:36 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:36:36 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000e01c5904c$552c5490$6c7aa8c0@ColbyM6805> Well... This was all caused by a lack of understanding of imports and references. I just needed to reference the right object (namespace?). I still haven't gotten back to this point but I do have all of my collection and oledb code working. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 08:55:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 09:55:25 -0400 Subject: [dba-VB] Connection strings for ado Message-ID: <000f01c59057$5abb3560$6c7aa8c0@ColbyM6805> I found this: http://www.connectionstrings.com/ John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 09:36:03 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 10:36:03 -0400 Subject: [dba-VB] .Net Strategies for classes connecting to data Message-ID: <000001c5905d$083c3950$6c7aa8c0@ColbyM6805> I have designed a class system for my Sysvars. I have it working for connecting to data in MDB files, however I am now looking to make it general enough to load data out of different types of data stores. Should I: 1) Just require the class user (programmer) to build their connection string, accept the connection string and load the data. 2) Overload the new() constructor to allow different methods where I build up the connection strings based on passed in pieces. 3) Allow the programmer to inherit the class and build a new() that does that final piece however they want. I want the class to be "just usable" with an Access BE (for my own purposes). OTOH, I also want to be able to use the class for connecting to SQL Server or XML files (specifically) without too much bother. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From ebarro at afsweb.com Sun Jul 24 11:12:20 2005 From: ebarro at afsweb.com (Eric Barro) Date: Sun, 24 Jul 2005 09:12:20 -0700 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> Message-ID: John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. From jwcolby at colbyconsulting.com Sun Jul 24 11:40:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 12:40:25 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000101c5906e$679c0e50$6c7aa8c0@ColbyM6805> Thanks for that tip. I'll start doing it that way. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Sun Jul 24 13:29:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Sun, 24 Jul 2005 14:29:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000001c5907d$952be200$2e01a8c0@dorismanning> In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 19:45:41 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 20:45:41 -0400 Subject: [dba-VB] XML Serialization Message-ID: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Well I made my base SysVar structure serializable and created a SerializeOut and SerializeIn in the SysVar collection class and voila, exports / imports of sysvars to XML files. Cool stuff. This means that I can now store SysVars in either an MDB or XML files. It "only" took FOUR days to figure all this stuff out starting with working VBA ADO classes in Access. One more class and I will have the full SysVar functionality that I had inside of VBA. The upside though is that learning how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation (and working examples) for much of the data manipulation stuff that I "just knew how to do" in VBA. So many properties/methods, so little time. And serialization to/from XML is pretty darned cool as well. I've only scratched the surface on that stuff. I must say I don't know what I would do without the internet though. I own one pretty good VB.Net book and three different ADO.Net books ad it is still waaaay faster to just Google for example code. Once I have working example code it is easy enough to pick up and understand what is going on. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 20:16:57 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 21:16:57 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000001c5907d$952be200$2e01a8c0@dorismanning> Message-ID: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. From mikedorism at verizon.net Mon Jul 25 08:50:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Mon, 25 Jul 2005 09:50:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Message-ID: <000501c5911f$c4fbd7e0$2e01a8c0@dorismanning> John, This website has a lot of really good tutorials. Take a look at #6 for info on structures. You can definitely do what you are trying to with a structure. http://www.programmersheaven.com/2/VB-NET-School Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 9:17 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Mon Jul 25 11:48:20 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Mon, 25 Jul 2005 09:48:20 -0700 Subject: [dba-VB] XML Serialization References: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Message-ID: <42E517D4.5020008@shaw.ca> I don't know if you are using ado streams to ouput or input an ado recordset as an xml file but here is some really rough test code I was running from Access97. I was using to debug Google's desktop search engines output of UTF-8 xml via Access There is code here to check the proper BOM marker on XML and also convert the output xml from the ado stream to different encoding types UTF-8, Unicode, ISO-8859-1, Big-5 etc. I also use this method to convert xml files to and fro from UTF-8 to UTF-16 encoding. UTF-8 being a mangled compression of UTF-16 with one caveat if the original xml characters aren't properly escaped such as Windows typographical chars they will be dropped by the conversion. This is a problem with the XML google pumps out. especially with international chars. Maybe there are enough notes to puzzle it out or give you somethings to consider. Sub ReadFileInUTF16() '1 LoadFromFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" MsgBox stm.ReadText End Sub Sub SaveFileinUTF8() '2 SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub ReadSaveFileInUTF8() '1/2 ReadToFile / SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub TranlateToUTF8() '3 charset snippet 'ERROR Don't Use this code, just to expose the google error Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" stm.Charset = "UTF-8" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub PersistStreamToXML() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set cnn = New ADODB.Connection cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & CurrentDb.Name & ";" Set rst = New ADODB.Recordset rst.Open "SELECT * FROM tblTest", cnn Set stm = New ADODB.stream rst.Save stm, adPersistXML rst.Close Set rst = Nothing MsgBox stm.Charset stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite Set stm = Nothing End Sub Sub ReadUTF8SaveFileInUTF16test() '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx Dim stm As ADODB.stream Dim strPath As String Dim strData As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.Position = 0 stm.Type = adTypeText 'stm.LoadFromFile strPath & "encUTF8.xml" stm.LoadFromFile "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml" ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 strData = stm.ReadText() Debug.Print strData stm.Position = 0 stm.Charset = "Unicode" ' "Unicode" '"ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strPath & "test16.xml", adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml", ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\XM8_UTF_vb.xml","C:\XML\Gil Encodings\test16.xml" Sub ReadUTF8SaveFileInUTF16(strFileIn As String, strFileOut As String) '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx 'used ado 2.7 Dim stm As ADODB.stream Dim strPath As String Dim strData As String 'the character set encoding names for the machine are in the registry 'For a list of the character set strings that is known by a system, see 'the subkeys of HKEY_CLASSES_ROOT\MIME\Database\Charset 'in the Windows Registry. Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" 'input file character set stm.Position = 0 stm.Type = adTypeText ' stm.LoadFromFile strFileIn ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 'reset to beginning of stream Dim strDataout strData = stm.ReadText() ' line below used to change encoding instruction for xml files ' 'strData = Replace(strData, "utf-8", "UTF-16", 1, 1) strData = Replace(strData, "utf-8", "UTF-16", 1, 1) Debug.Print strData stm.Position = 0 ' set output file character set stm.Charset = "UTF-16" ' "Unicode" '"iso-8859-1" "ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strFileOut, adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub Public Function Replace(strIn As Variant, strFind As String, _ strReplace As String, Optional intStart As Integer = 1, _ Optional intCount As Integer = -1, _ Optional intCompare As Integer = 0) As String '----------------------------------------------------------- ' Inputs: String to search and replace, ' search string, replacement string, ' optional starting position (default = 1), ' optional replacement limit (default = -1 .. ALL) ' optional string compare value (default = 0 .. vbBinaryCompare) ' Outputs: Replaced string ' Created By: JLV 09/05/01 ' Last Revised: JLV 09/05/01 ' ** Duplicates the functionality of the VB 6 REPLACE function. '----------------------------------------------------------- Dim strWork As String, intS As Integer, intCnt As Integer Dim intI As Integer, intLenF As Integer, intLenR As Integer If (intCompare < 0) Or (intCompare > 2) Then Err.Raise 5 Exit Function End If If VarType(strIn) <> vbString Then Err.Raise 5 Exit Function End If strWork = strIn intS = intStart intCnt = intCount intLenF = Len(strFind) intLenR = Len(strReplace) ' If find string zero length or count is zero, then nothing to replace If (intLenF = 0) Or (intCnt = 0) Then Replace = strIn Exit Function End If ' If start beyond length of string, return empty string If intS > Len(strWork) Then Replace = "" Exit Function End If ' Got some work to do -- find strings to replace Do intI = InStr(intS, strWork, strFind, intCompare) If intI = 0 Then Exit Do ' Insert the replace string strWork = Left(strWork, intI - 1) & strReplace & Mid(strWork, intI + intLenF) intS = intS + intI + intLenR - 1 ' Bump start to end of the replace string intCnt = intCnt - 1 ' Decrement the max replace counter Loop Until intCnt = 0 Replace = strWork End Function Public Function GetPath(ByVal strFilePath As String) As String Dim s As String Dim i As Integer For i = Len(strFilePath) To 1 Step -1 s = Mid$(strFilePath, i, 1) If StrComp(s, "\", vbBinaryCompare) = 0 Then GetPath = Left$(strFilePath, i) Exit For End If Next End Function Sub CheckBOM(Optional strFileIn As Variant, Optional strIn As Variant) 'checkbom "C:\XML\Gil Encodings\encUTF8_NoDecl.xml" On Error GoTo Err_handler Dim strInputData As String * 4 Dim lpBuffer() As Byte Dim intFreeFile As Integer If Not IsMissing(strFileIn) Then intFreeFile = FreeFile Open strFileIn For Binary Access Read Lock Read As #intFreeFile Len = 4 ReDim lpBuffer(4) Get #intFreeFile, , lpBuffer Close #intFreeFile ElseIf Not IsMissing(strIn) Then 'Can't makes this work since VBA is always converting the string to UTF-16LE lpBuffer = Left$(strIn, 4) Else MsgBox "Nothing To Do" Exit Sub End If If lpBuffer(0) = 255 And lpBuffer(1) = 254 Then Debug.Print "File is UTF-16 Little Endian" ElseIf lpBuffer(0) = 254 And lpBuffer(1) = 255 Then Debug.Print "File is UTF-16 Big Endian" ElseIf lpBuffer(0) = 239 And lpBuffer(1) = 187 And lpBuffer(2) = 191 Then Debug.Print "File is UTF-8" 'Start trying to figure out by other means this will only work on xml files that start with "= 128 And lngUCS_dec < 2048 Then bytOne = 192 + (lngUCS_dec \ 64) bytTwo = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo)) ElseIf lngUCS_dec >= 2048 And lngUCS_dec < 65536 Then bytOne = 224 + (lngUCS_dec \ 4096) bytTwo = 128 + ((lngUCS_dec \ 64) Mod 64) bytThree = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo) & Hex(bytThree)) Else MsgBox "Character Out of Range" End If End Function John W. Colby wrote: >Well I made my base SysVar structure serializable and created a SerializeOut >and SerializeIn in the SysVar collection class and voila, exports / imports >of sysvars to XML files. Cool stuff. This means that I can now store >SysVars in either an MDB or XML files. > >It "only" took FOUR days to figure all this stuff out starting with working >VBA ADO classes in Access. One more class and I will have the full SysVar >functionality that I had inside of VBA. The upside though is that learning >how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation >(and working examples) for much of the data manipulation stuff that I "just >knew how to do" in VBA. So many properties/methods, so little time. And >serialization to/from XML is pretty darned cool as well. I've only >scratched the surface on that stuff. > >I must say I don't know what I would do without the internet though. I own >one pretty good VB.Net book and three different ADO.Net books ad it is still >waaaay faster to just Google for example code. Once I have working example >code it is easy enough to pick up and understand what is going on. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Mon Jul 25 18:17:45 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Mon, 25 Jul 2005 19:17:45 -0400 Subject: [dba-VB] Inheriting collections Message-ID: <000101c5916f$10e38230$6c7aa8c0@ColbyM6805> Being new to this inheritance thing (in the last 15 years), I have a conceptual question: In my SysVarRec I use a data class (or structure) that holds one record's worth of SysVar data from a specific table. I use a SysVarsTbl class that holds a collection of SysVarRec instances. This class loads all of the sysvar records from a single table, loading each record's data into a SysVarRec class or structure. I use a SysVars class which loads one or more instances of SysVarsTbl, storing each SysVarsTbl class into a collection. ADDITIONALLY, this class then merges all of the SysVarsTbl class' data into a single collection of SysVars. This collection is nothing more than a keyed collection, where the value is stored, with a key to index into the collection. The objective here is to allow several different copies of a SysVars table to exist, where the "last loaded wins". For example, suppose I have a SysVar called EnableZip, whose value is True/False. If True the Zip functionality is loaded as the framework sets up. In the framework's copy of tblSysVars, EnableZip exists but is set to false. Thus as the framework initializes, the zip functionality is not loaded. In the application's copy of tblSysVars, EnableZip is True because this application needs to zip files. The tables load Framework.tblSysVar and then Application.tblSysVars. EnableZip=false loads from the framework table, but then the EnableZip=True loads from the application table loads and "overrides" the framework's SysVar. What really happens is that the EnableZip is found already loaded and changed from False to True. Thus by the time the application table finishes loading, EnableZip is True and the zip functionality of the framework loads. Well, you get the idea anyway. Think up your own scenario. The question now is... Since a class can be inherited, should SysVarsTbl inherit the collection class so that all of the collection functionality is native to the SysVarsTbl class? Or should the SysVarsTbl class simply have a collection class variable that it sets up and loads an instance of the collection class? IOW, SysVarsTbl needs a collection but it could BE a collection or it could just dim and use a collection. VBA did not have this ability, so I became accustomed to just "consuming" collections, i.e. using them. But now the class that needs a collection could BE a collection class, with all of the functionality of the collection class inherited right in and specific non-collection functionality added to it (loading records out of a table for example). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jeff at outbaktech.com Tue Jul 26 15:58:48 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 15:58:48 -0500 Subject: [dba-VB] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com From Jeff at outbaktech.com Tue Jul 26 21:27:15 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 21:27:15 -0500 Subject: [dba-VB] RE: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Sorry, I should have been more specific. I was contacted by a recruiter who is looking for a .NET developer looking for a long term contract in Neenah, WI. The company is looking for 10 years experience in IT and at least 2 years experience with .NET. I was told that they are willing to relax their requirements a little for a 'local boy (or girl). If anyone is interested, please contact me off-list and I will send additional information, including the recruiters name and contact information. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com -----Original Message----- From: dba-ot-bounces at databaseadvisors.com [mailto:dba-ot-bounces at databaseadvisors.com] On Behalf Of Jeff Barrows Sent: Tuesday, July 26, 2005 3:59 PM To: dba-OT; Dba-Tech; dba-VB; AccessD Subject: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com _______________________________________________ dba-OT mailing list dba-OT at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-ot Website: http://www.databaseadvisors.com From Jeff at outbaktech.com Thu Jul 28 09:37:56 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Thu, 28 Jul 2005 09:37:56 -0500 Subject: [dba-VB] RE: [dba-Tech] RE: [dba-OT] Cross Posted: Looking for a .NET developernear Neenah, WI Message-ID: I have already responded to one individual off-list. If anyone else is interested in additional information, please contact me directly at the email address in my signature. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Phone: 886-5913 Fax: 886-5932 Racine, WI jeff at outbaktech.com From fhtapia at gmail.com Thu Jul 28 16:47:34 2005 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 28 Jul 2005 14:47:34 -0700 Subject: [dba-VB] SoapClient in VBscript Message-ID: I have a webservice which I will need to call fom a vbscript (in the end it will be a sp_OA type call, but for this purpose it's a vbscript... I'm looking at the wsdl file and I choose the "CreateOrder" method but I keep getting invalid parameter settings for it... (WSDL file sample included), my current example soap call looks like this: ---Soap---- Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") SOAPClient.mssoapinit (" http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") sxml = "
FO100 HFO-TEST 9002658 Div Of Test 7858 Thorndike Rd GreensBoro NC 27409 United States Test 8055551234 test 100 TEST9999
14-7068 15 21222
" Result = SOAPClient.CreateOrder(sxml) ---endSoap---- I keep getting this error: Server was unable to process request --->Object reference not set to an instance of an object, any ideas??? -----------wsdl----------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----------end wsdl----------- -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspot.com | Tsql and More... From martyconnelly at shaw.ca Fri Jul 29 00:44:07 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Jul 2005 22:44:07 -0700 Subject: [dba-VB] SoapClient in VBscript References: Message-ID: <42E9C227.3080409@shaw.ca> You might take two approaches to check for errors. 1. Using Access and the webservice wizard, point it at your wsdl and create the class code then move that to your vbscript.and call it. 2. use xmlhttp to fire your xml string at the wsdl and parse the returned xml. I have some basic code lying around to do this from VBA 3 Also check you have a valid wsdl file There are a few few of these validator sites on the web http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway Also for ASP I think it should be which might be why it isn't finding the object Dim oSOAP Set oSOAPClient = Server.CreateObject("MSSOAP.So?apClient30") oSOAPClient.ClientProperty("ServerHT?TPRequest") = True ... blah blah Francisco Tapia wrote: >I have a webservice which I will need to call fom a vbscript (in the end it >will be a sp_OA type call, but for this purpose it's a vbscript... I'm >looking at the wsdl file and I choose the "CreateOrder" method but I keep >getting invalid parameter settings for it... (WSDL file sample included), my >current example soap call looks like this: > >---Soap---- >Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") >SOAPClient.mssoapinit (" >http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") > >sxml = "
FO100 >HFO-TEST 9002658 >Div Of Test 7858 Thorndike Rd > GreensBoro NC 27409 >United States Test >8055551234 test 100 >TEST9999 />
14-7068 >15 21222 >
" > >Result = SOAPClient.CreateOrder(sxml) > >---endSoap---- > >I keep getting this error: Server was unable to process request --->Object >reference not set to an instance of an object, any ideas??? > >-----------wsdl----------------- >- > >- > >- > >- > >- > >- > > > > > >- > >- > >type="tns:WSOrderHeader"/> >type="tns:ArrayOfWSOrderItem"/> > > >- > >- > > > > > > > > > > > > > > > > >type="s:string"/> > > > > > >- > >- > >nillable="true" type="tns:WSOrderItem"/> > > >- > >- > > > > > > >- > >- > >- > >type="tns:CreateOrderResponse"/> > > > >- > >- > > >type="s:string"/> >type="s:string"/> > > > > >- > > > >- > > > >- > >- > > > > > > > >- > >style="document"/> >- > > >- > > > >- > > > > > >- >type="tns:WebServiceOrderHttpGet"> > > >- >type="tns:WebServiceOrderHttpPost"> > > >- > > >- > > > >- >binding="tns:WebServiceOrderHttpGet"> > > >- >binding="tns:WebServiceOrderHttpPost"> > > > > > >----------end wsdl----------- > > > -- Marty Connelly Victoria, B.C. Canada From RRANTHON at sentara.com Fri Jul 29 13:06:33 2005 From: RRANTHON at sentara.com (Randall R Anthony) Date: Fri, 29 Jul 2005 14:06:33 -0400 Subject: [dba-VB] Common Dialogue to Open Files-Search Message-ID: <200507291806.j6TI6nR08115@databaseadvisors.com> Hi listers, Friday pm brain cramp, I can't seem to find the info for using the MS common dialogue control to create the M$ Office Open Files in an Access app I'm working on. Any help would be appreciated. I've used this before but can't find where I put it. Thanks! From martyconnelly at shaw.ca Fri Jul 29 14:40:02 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 29 Jul 2005 12:40:02 -0700 Subject: [dba-VB] Common Dialogue to Open Files-Search References: <200507291806.j6TI6nR08115@databaseadvisors.com> Message-ID: <42EA8612.5030703@shaw.ca> API: Call the standard Windows File Open/Save dialog box http://www.mvps.org/access/api/api0001.htm Or you can use Application.FileDialog in Access XP and higher and do multisect, open or save, however fails with runtimes. Sub test() 'needs reference to MS Office Object library ' No go with Runtime Dim dlgOpen As Object 'FileDialog Set dlgOpen = Application.FileDialog(msoFileDialogOpen) With dlgOpen .InitialFileName = "C:\" .Show End With 'or Dim strfile As String, fdObj As FileDialog Set fdObj = Application.FileDialog(msoFileDialogFilePicker) If fdObj.Show = -1 Then MsgBox fdObj.SelectedItems(1) Else MsgBox "You didn't select a file!" End If Set fdObj = Nothing End Sub Randall R Anthony wrote: >Hi listers, >Friday pm brain cramp, I can't seem to find the info for using the MS >common dialogue control to create the M$ Office Open Files in an Access >app I'm working on. Any help would be appreciated. I've used this >before but can't find where I put it. Thanks! >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From bkollodge at parkindustries.com Thu Jul 14 13:52:32 2005 From: bkollodge at parkindustries.com (Bill Kollodge) Date: Thu, 14 Jul 2005 13:52:32 -0500 Subject: [dba-VB] VB to VB via Ethernet Message-ID: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Hi folks, can anyone offer me direction or suggestions on how to enable 2 computers, each running their own VB application, to communicate to each other via Ethernet? I need to have one automated machine notify another when it is complete (or some other event happens). The machines run VB apps. Not sure where to even start. Any help/experience is greatly appreciated. Thanks, Bill Kollodge Software Engineering / CNC Products Park Industries St. Cloud, MN 56303 bkollodge at parkindustries.com This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. From sgsax at ksu.edu Thu Jul 14 14:12:34 2005 From: sgsax at ksu.edu (Seth Galitzer) Date: Thu, 14 Jul 2005 14:12:34 -0500 Subject: [dba-VB] VB to VB via Ethernet In-Reply-To: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> References: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Message-ID: <42D6B922.4010604@ksu.edu> Bill, As always, there are several ways to do this. I can think of two. 1) Write a TCP/IP client/server app. There are many examples for this on the web. You want to search for examples of using Windows Sockets in VB. With this method, you would write a server app which would listen on a port for a message from the client (which you would also write an app for). This message could be anything, from just a "done" message, to a periodic "status" message. 2) Create a shared directory on the "server" machine. On the "client" machine, when it finishes its task, write to a file on the server's shared directory, either using the full UNC path or map a drive letter to the location on the server. On the server, write an app that looks in that directory for the existence of this file. You can either read from the file, or just check to see if it exists. Once you've determined the status, either delete the file or reset its contents using the server app. Of these two methods, 2) would probably be easier, since it's only using built-in file and directory I/O methods and would require no new programming skills (like using Windows Sockets), but 1) would be more fun, as you would get to learn new programming skills (like using Windows Sockets). Seth Bill Kollodge wrote: > Hi folks, can anyone offer me direction or suggestions on how to enable > 2 computers, each running their own VB application, to communicate to > each other via Ethernet? > > I need to have one automated machine notify another when it is complete > (or some other event happens). The machines run VB apps. Not sure > where to even start. Any help/experience is greatly appreciated. > > Thanks, > > Bill Kollodge > Software Engineering / CNC Products > Park Industries > St. Cloud, MN 56303 > bkollodge at parkindustries.com > > > > This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From jwcolby at colbyconsulting.com Thu Jul 21 13:50:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Thu, 21 Jul 2005 14:50:00 -0400 Subject: [dba-VB] VBExpress videos Message-ID: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From accessd at shaw.ca Thu Jul 21 14:02:12 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 21 Jul 2005 12:02:12 -0700 Subject: [dba-VB] VBExpress videos In-Reply-To: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> Message-ID: <0IJZ00C18RJK5W@l-daemon> Thanks for the info. John -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Thursday, July 21, 2005 11:50 AM To: VBA; AccessD Subject: [dba-VB] VBExpress videos In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 06:27:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 07:27:15 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <0IJZ00C18RJK5W@l-daemon> Message-ID: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jdemarco at hudsonhealthplan.org Fri Jul 22 06:53:43 2005 From: Jdemarco at hudsonhealthplan.org (Jim DeMarco) Date: Fri, 22 Jul 2005 07:53:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <08F823FD83787D4BA0B99CA580AD3C74016C3BA3@TTNEXCHCL2.hshhp.com> John, I don't have an example handy at the moment but I believe you can walk the records in a given table in a Dataset object. I may have something here to show you if I get a chance to look around later. Jim DeMarco -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". *********************************************************************************** From mikedorism at verizon.net Fri Jul 22 07:10:43 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 08:10:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> Message-ID: <000001c58eb6$63215c90$2f01a8c0@dorismanning> In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 07:30:48 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 08:30:48 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000001c58eb6$63215c90$2f01a8c0@dorismanning> Message-ID: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:07:40 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:07:40 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Message-ID: <000101c58ebe$57b75410$2f01a8c0@dorismanning> The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 08:08:33 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 14:08:33 +0100 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <200507221259.j6MCx6r13571@smarthost.yourcomms.net> Hi With a dataset you can do this Dim drows() as datarow = ds.tables(0).Select("ClientID = " & intID) to find a specific record Then can use drows.count or For each dRow in drows '' do something Next Both datareaders and datasets allow field references dr("ClientID") and ds("ClientID") Hope this helps Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 13:31 To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 08:24:37 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 09:24:37 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000101c58ebe$57b75410$2f01a8c0@dorismanning> Message-ID: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:34:35 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:34:35 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> Message-ID: <000201c58ec2$1a921cb0$2f01a8c0@dorismanning> I know what you mean. I had to piece it all out the hard way just like you are. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 9:25 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:54:28 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:54:28 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, I think what you are looking for is a filter. Google 'ado recordset filter' Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:57:34 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:57:34 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:04:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:04:00 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001901c58ec6$35ad3620$6c7aa8c0@ColbyM6805> Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:14:24 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:14:24 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From marcus at tsstech.com Fri Jul 22 09:18:42 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:18:42 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: This website gives an overview of ADO.Net and vb.net. http://www.programmersheaven.com/articles/patrik/Hierarchical.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:21:43 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:21:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:37:59 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:37:59 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, Also have a look at DataViews. Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 10:02:39 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 11:02:39 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Bear in mind that I could have called the Reader object 'rst'(or any valid variable name, Reader is not a reserved word) and the code would be exactly the same. That's why it was a little confusing what you were asking. Plus I jumped in the middle of the thread. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:22 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 10:23:38 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 11:23:38 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> Message-ID: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From mikedorism at verizon.net Fri Jul 22 10:35:11 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 11:35:11 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 11:09:18 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 17:09:18 +0100 Subject: [dba-VB] Add executable solution to project Message-ID: <200507221559.j6MFxor27655@smarthost.yourcomms.net> Hi I think if you add the project (which contains the code in the dll) to your solution you can then debug the dll code - you can then set a reference in your main project/solution to reference that project (as opposed to the dll) HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 16:24 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:24:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:24:15 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Message-ID: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 11:35:14 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 12:35:14 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> Message-ID: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:45:19 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:45:19 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Message-ID: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Yes, but as soon as I do that, then I am right back to the "namespace system.data cannot be found". For some reason, the namespaces I use in that class library are valid in a "class library" but are not valid in a "Windows Application". John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 12:35 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 06:42:53 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 07:42:53 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Message-ID: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:14:49 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:14:49 -0400 Subject: [dba-VB] .net correct version of jet Message-ID: <000d01c59049$49ec9160$6c7aa8c0@ColbyM6805> I am using the following code to set up a connection. Public Sub New(ByVal lstrMDBFileSpec As String, ByVal lstrTblName As String) Dim mstrCnnJet As String = "Provider=Microsoft.Jet.OLEDB.4.0;" mstrCnn = mstrCnnJet & lstrMDBFileSpec mstrTblName = lstrTblName LoadSysVars(mstrCnn) End Sub The code passes in a filespec for an MDB container that a table resides in and the table name. Inside new() the mstrcnn is built up by appending mstrCnnJet and lstrMDBFileSpec. This works but it seems that I am getting awfully specific in mstrCnnJet. Is there a way to determine what version of Microsoft.Jet.OLEDB is available on the machine that the code is running on? Or is this a non-issue as there is only (and will only ever be) one version (4.0)? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:36:36 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:36:36 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000e01c5904c$552c5490$6c7aa8c0@ColbyM6805> Well... This was all caused by a lack of understanding of imports and references. I just needed to reference the right object (namespace?). I still haven't gotten back to this point but I do have all of my collection and oledb code working. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 08:55:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 09:55:25 -0400 Subject: [dba-VB] Connection strings for ado Message-ID: <000f01c59057$5abb3560$6c7aa8c0@ColbyM6805> I found this: http://www.connectionstrings.com/ John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 09:36:03 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 10:36:03 -0400 Subject: [dba-VB] .Net Strategies for classes connecting to data Message-ID: <000001c5905d$083c3950$6c7aa8c0@ColbyM6805> I have designed a class system for my Sysvars. I have it working for connecting to data in MDB files, however I am now looking to make it general enough to load data out of different types of data stores. Should I: 1) Just require the class user (programmer) to build their connection string, accept the connection string and load the data. 2) Overload the new() constructor to allow different methods where I build up the connection strings based on passed in pieces. 3) Allow the programmer to inherit the class and build a new() that does that final piece however they want. I want the class to be "just usable" with an Access BE (for my own purposes). OTOH, I also want to be able to use the class for connecting to SQL Server or XML files (specifically) without too much bother. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From ebarro at afsweb.com Sun Jul 24 11:12:20 2005 From: ebarro at afsweb.com (Eric Barro) Date: Sun, 24 Jul 2005 09:12:20 -0700 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> Message-ID: John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. From jwcolby at colbyconsulting.com Sun Jul 24 11:40:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 12:40:25 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000101c5906e$679c0e50$6c7aa8c0@ColbyM6805> Thanks for that tip. I'll start doing it that way. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Sun Jul 24 13:29:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Sun, 24 Jul 2005 14:29:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000001c5907d$952be200$2e01a8c0@dorismanning> In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 19:45:41 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 20:45:41 -0400 Subject: [dba-VB] XML Serialization Message-ID: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Well I made my base SysVar structure serializable and created a SerializeOut and SerializeIn in the SysVar collection class and voila, exports / imports of sysvars to XML files. Cool stuff. This means that I can now store SysVars in either an MDB or XML files. It "only" took FOUR days to figure all this stuff out starting with working VBA ADO classes in Access. One more class and I will have the full SysVar functionality that I had inside of VBA. The upside though is that learning how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation (and working examples) for much of the data manipulation stuff that I "just knew how to do" in VBA. So many properties/methods, so little time. And serialization to/from XML is pretty darned cool as well. I've only scratched the surface on that stuff. I must say I don't know what I would do without the internet though. I own one pretty good VB.Net book and three different ADO.Net books ad it is still waaaay faster to just Google for example code. Once I have working example code it is easy enough to pick up and understand what is going on. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 20:16:57 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 21:16:57 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000001c5907d$952be200$2e01a8c0@dorismanning> Message-ID: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. From mikedorism at verizon.net Mon Jul 25 08:50:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Mon, 25 Jul 2005 09:50:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Message-ID: <000501c5911f$c4fbd7e0$2e01a8c0@dorismanning> John, This website has a lot of really good tutorials. Take a look at #6 for info on structures. You can definitely do what you are trying to with a structure. http://www.programmersheaven.com/2/VB-NET-School Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 9:17 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Mon Jul 25 11:48:20 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Mon, 25 Jul 2005 09:48:20 -0700 Subject: [dba-VB] XML Serialization References: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Message-ID: <42E517D4.5020008@shaw.ca> I don't know if you are using ado streams to ouput or input an ado recordset as an xml file but here is some really rough test code I was running from Access97. I was using to debug Google's desktop search engines output of UTF-8 xml via Access There is code here to check the proper BOM marker on XML and also convert the output xml from the ado stream to different encoding types UTF-8, Unicode, ISO-8859-1, Big-5 etc. I also use this method to convert xml files to and fro from UTF-8 to UTF-16 encoding. UTF-8 being a mangled compression of UTF-16 with one caveat if the original xml characters aren't properly escaped such as Windows typographical chars they will be dropped by the conversion. This is a problem with the XML google pumps out. especially with international chars. Maybe there are enough notes to puzzle it out or give you somethings to consider. Sub ReadFileInUTF16() '1 LoadFromFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" MsgBox stm.ReadText End Sub Sub SaveFileinUTF8() '2 SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub ReadSaveFileInUTF8() '1/2 ReadToFile / SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub TranlateToUTF8() '3 charset snippet 'ERROR Don't Use this code, just to expose the google error Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" stm.Charset = "UTF-8" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub PersistStreamToXML() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set cnn = New ADODB.Connection cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & CurrentDb.Name & ";" Set rst = New ADODB.Recordset rst.Open "SELECT * FROM tblTest", cnn Set stm = New ADODB.stream rst.Save stm, adPersistXML rst.Close Set rst = Nothing MsgBox stm.Charset stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite Set stm = Nothing End Sub Sub ReadUTF8SaveFileInUTF16test() '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx Dim stm As ADODB.stream Dim strPath As String Dim strData As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.Position = 0 stm.Type = adTypeText 'stm.LoadFromFile strPath & "encUTF8.xml" stm.LoadFromFile "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml" ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 strData = stm.ReadText() Debug.Print strData stm.Position = 0 stm.Charset = "Unicode" ' "Unicode" '"ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strPath & "test16.xml", adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml", ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\XM8_UTF_vb.xml","C:\XML\Gil Encodings\test16.xml" Sub ReadUTF8SaveFileInUTF16(strFileIn As String, strFileOut As String) '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx 'used ado 2.7 Dim stm As ADODB.stream Dim strPath As String Dim strData As String 'the character set encoding names for the machine are in the registry 'For a list of the character set strings that is known by a system, see 'the subkeys of HKEY_CLASSES_ROOT\MIME\Database\Charset 'in the Windows Registry. Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" 'input file character set stm.Position = 0 stm.Type = adTypeText ' stm.LoadFromFile strFileIn ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 'reset to beginning of stream Dim strDataout strData = stm.ReadText() ' line below used to change encoding instruction for xml files ' 'strData = Replace(strData, "utf-8", "UTF-16", 1, 1) strData = Replace(strData, "utf-8", "UTF-16", 1, 1) Debug.Print strData stm.Position = 0 ' set output file character set stm.Charset = "UTF-16" ' "Unicode" '"iso-8859-1" "ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strFileOut, adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub Public Function Replace(strIn As Variant, strFind As String, _ strReplace As String, Optional intStart As Integer = 1, _ Optional intCount As Integer = -1, _ Optional intCompare As Integer = 0) As String '----------------------------------------------------------- ' Inputs: String to search and replace, ' search string, replacement string, ' optional starting position (default = 1), ' optional replacement limit (default = -1 .. ALL) ' optional string compare value (default = 0 .. vbBinaryCompare) ' Outputs: Replaced string ' Created By: JLV 09/05/01 ' Last Revised: JLV 09/05/01 ' ** Duplicates the functionality of the VB 6 REPLACE function. '----------------------------------------------------------- Dim strWork As String, intS As Integer, intCnt As Integer Dim intI As Integer, intLenF As Integer, intLenR As Integer If (intCompare < 0) Or (intCompare > 2) Then Err.Raise 5 Exit Function End If If VarType(strIn) <> vbString Then Err.Raise 5 Exit Function End If strWork = strIn intS = intStart intCnt = intCount intLenF = Len(strFind) intLenR = Len(strReplace) ' If find string zero length or count is zero, then nothing to replace If (intLenF = 0) Or (intCnt = 0) Then Replace = strIn Exit Function End If ' If start beyond length of string, return empty string If intS > Len(strWork) Then Replace = "" Exit Function End If ' Got some work to do -- find strings to replace Do intI = InStr(intS, strWork, strFind, intCompare) If intI = 0 Then Exit Do ' Insert the replace string strWork = Left(strWork, intI - 1) & strReplace & Mid(strWork, intI + intLenF) intS = intS + intI + intLenR - 1 ' Bump start to end of the replace string intCnt = intCnt - 1 ' Decrement the max replace counter Loop Until intCnt = 0 Replace = strWork End Function Public Function GetPath(ByVal strFilePath As String) As String Dim s As String Dim i As Integer For i = Len(strFilePath) To 1 Step -1 s = Mid$(strFilePath, i, 1) If StrComp(s, "\", vbBinaryCompare) = 0 Then GetPath = Left$(strFilePath, i) Exit For End If Next End Function Sub CheckBOM(Optional strFileIn As Variant, Optional strIn As Variant) 'checkbom "C:\XML\Gil Encodings\encUTF8_NoDecl.xml" On Error GoTo Err_handler Dim strInputData As String * 4 Dim lpBuffer() As Byte Dim intFreeFile As Integer If Not IsMissing(strFileIn) Then intFreeFile = FreeFile Open strFileIn For Binary Access Read Lock Read As #intFreeFile Len = 4 ReDim lpBuffer(4) Get #intFreeFile, , lpBuffer Close #intFreeFile ElseIf Not IsMissing(strIn) Then 'Can't makes this work since VBA is always converting the string to UTF-16LE lpBuffer = Left$(strIn, 4) Else MsgBox "Nothing To Do" Exit Sub End If If lpBuffer(0) = 255 And lpBuffer(1) = 254 Then Debug.Print "File is UTF-16 Little Endian" ElseIf lpBuffer(0) = 254 And lpBuffer(1) = 255 Then Debug.Print "File is UTF-16 Big Endian" ElseIf lpBuffer(0) = 239 And lpBuffer(1) = 187 And lpBuffer(2) = 191 Then Debug.Print "File is UTF-8" 'Start trying to figure out by other means this will only work on xml files that start with "= 128 And lngUCS_dec < 2048 Then bytOne = 192 + (lngUCS_dec \ 64) bytTwo = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo)) ElseIf lngUCS_dec >= 2048 And lngUCS_dec < 65536 Then bytOne = 224 + (lngUCS_dec \ 4096) bytTwo = 128 + ((lngUCS_dec \ 64) Mod 64) bytThree = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo) & Hex(bytThree)) Else MsgBox "Character Out of Range" End If End Function John W. Colby wrote: >Well I made my base SysVar structure serializable and created a SerializeOut >and SerializeIn in the SysVar collection class and voila, exports / imports >of sysvars to XML files. Cool stuff. This means that I can now store >SysVars in either an MDB or XML files. > >It "only" took FOUR days to figure all this stuff out starting with working >VBA ADO classes in Access. One more class and I will have the full SysVar >functionality that I had inside of VBA. The upside though is that learning >how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation >(and working examples) for much of the data manipulation stuff that I "just >knew how to do" in VBA. So many properties/methods, so little time. And >serialization to/from XML is pretty darned cool as well. I've only >scratched the surface on that stuff. > >I must say I don't know what I would do without the internet though. I own >one pretty good VB.Net book and three different ADO.Net books ad it is still >waaaay faster to just Google for example code. Once I have working example >code it is easy enough to pick up and understand what is going on. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Mon Jul 25 18:17:45 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Mon, 25 Jul 2005 19:17:45 -0400 Subject: [dba-VB] Inheriting collections Message-ID: <000101c5916f$10e38230$6c7aa8c0@ColbyM6805> Being new to this inheritance thing (in the last 15 years), I have a conceptual question: In my SysVarRec I use a data class (or structure) that holds one record's worth of SysVar data from a specific table. I use a SysVarsTbl class that holds a collection of SysVarRec instances. This class loads all of the sysvar records from a single table, loading each record's data into a SysVarRec class or structure. I use a SysVars class which loads one or more instances of SysVarsTbl, storing each SysVarsTbl class into a collection. ADDITIONALLY, this class then merges all of the SysVarsTbl class' data into a single collection of SysVars. This collection is nothing more than a keyed collection, where the value is stored, with a key to index into the collection. The objective here is to allow several different copies of a SysVars table to exist, where the "last loaded wins". For example, suppose I have a SysVar called EnableZip, whose value is True/False. If True the Zip functionality is loaded as the framework sets up. In the framework's copy of tblSysVars, EnableZip exists but is set to false. Thus as the framework initializes, the zip functionality is not loaded. In the application's copy of tblSysVars, EnableZip is True because this application needs to zip files. The tables load Framework.tblSysVar and then Application.tblSysVars. EnableZip=false loads from the framework table, but then the EnableZip=True loads from the application table loads and "overrides" the framework's SysVar. What really happens is that the EnableZip is found already loaded and changed from False to True. Thus by the time the application table finishes loading, EnableZip is True and the zip functionality of the framework loads. Well, you get the idea anyway. Think up your own scenario. The question now is... Since a class can be inherited, should SysVarsTbl inherit the collection class so that all of the collection functionality is native to the SysVarsTbl class? Or should the SysVarsTbl class simply have a collection class variable that it sets up and loads an instance of the collection class? IOW, SysVarsTbl needs a collection but it could BE a collection or it could just dim and use a collection. VBA did not have this ability, so I became accustomed to just "consuming" collections, i.e. using them. But now the class that needs a collection could BE a collection class, with all of the functionality of the collection class inherited right in and specific non-collection functionality added to it (loading records out of a table for example). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jeff at outbaktech.com Tue Jul 26 15:58:48 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 15:58:48 -0500 Subject: [dba-VB] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com From Jeff at outbaktech.com Tue Jul 26 21:27:15 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 21:27:15 -0500 Subject: [dba-VB] RE: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Sorry, I should have been more specific. I was contacted by a recruiter who is looking for a .NET developer looking for a long term contract in Neenah, WI. The company is looking for 10 years experience in IT and at least 2 years experience with .NET. I was told that they are willing to relax their requirements a little for a 'local boy (or girl). If anyone is interested, please contact me off-list and I will send additional information, including the recruiters name and contact information. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com -----Original Message----- From: dba-ot-bounces at databaseadvisors.com [mailto:dba-ot-bounces at databaseadvisors.com] On Behalf Of Jeff Barrows Sent: Tuesday, July 26, 2005 3:59 PM To: dba-OT; Dba-Tech; dba-VB; AccessD Subject: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com _______________________________________________ dba-OT mailing list dba-OT at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-ot Website: http://www.databaseadvisors.com From Jeff at outbaktech.com Thu Jul 28 09:37:56 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Thu, 28 Jul 2005 09:37:56 -0500 Subject: [dba-VB] RE: [dba-Tech] RE: [dba-OT] Cross Posted: Looking for a .NET developernear Neenah, WI Message-ID: I have already responded to one individual off-list. If anyone else is interested in additional information, please contact me directly at the email address in my signature. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Phone: 886-5913 Fax: 886-5932 Racine, WI jeff at outbaktech.com From fhtapia at gmail.com Thu Jul 28 16:47:34 2005 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 28 Jul 2005 14:47:34 -0700 Subject: [dba-VB] SoapClient in VBscript Message-ID: I have a webservice which I will need to call fom a vbscript (in the end it will be a sp_OA type call, but for this purpose it's a vbscript... I'm looking at the wsdl file and I choose the "CreateOrder" method but I keep getting invalid parameter settings for it... (WSDL file sample included), my current example soap call looks like this: ---Soap---- Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") SOAPClient.mssoapinit (" http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") sxml = "
FO100 HFO-TEST 9002658 Div Of Test 7858 Thorndike Rd GreensBoro NC 27409 United States Test 8055551234 test 100 TEST9999
14-7068 15 21222
" Result = SOAPClient.CreateOrder(sxml) ---endSoap---- I keep getting this error: Server was unable to process request --->Object reference not set to an instance of an object, any ideas??? -----------wsdl----------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----------end wsdl----------- -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspot.com | Tsql and More... From martyconnelly at shaw.ca Fri Jul 29 00:44:07 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Jul 2005 22:44:07 -0700 Subject: [dba-VB] SoapClient in VBscript References: Message-ID: <42E9C227.3080409@shaw.ca> You might take two approaches to check for errors. 1. Using Access and the webservice wizard, point it at your wsdl and create the class code then move that to your vbscript.and call it. 2. use xmlhttp to fire your xml string at the wsdl and parse the returned xml. I have some basic code lying around to do this from VBA 3 Also check you have a valid wsdl file There are a few few of these validator sites on the web http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway Also for ASP I think it should be which might be why it isn't finding the object Dim oSOAP Set oSOAPClient = Server.CreateObject("MSSOAP.So?apClient30") oSOAPClient.ClientProperty("ServerHT?TPRequest") = True ... blah blah Francisco Tapia wrote: >I have a webservice which I will need to call fom a vbscript (in the end it >will be a sp_OA type call, but for this purpose it's a vbscript... I'm >looking at the wsdl file and I choose the "CreateOrder" method but I keep >getting invalid parameter settings for it... (WSDL file sample included), my >current example soap call looks like this: > >---Soap---- >Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") >SOAPClient.mssoapinit (" >http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") > >sxml = "
FO100 >HFO-TEST 9002658 >Div Of Test 7858 Thorndike Rd > GreensBoro NC 27409 >United States Test >8055551234 test 100 >TEST9999 />
14-7068 >15 21222 >
" > >Result = SOAPClient.CreateOrder(sxml) > >---endSoap---- > >I keep getting this error: Server was unable to process request --->Object >reference not set to an instance of an object, any ideas??? > >-----------wsdl----------------- >- > >- > >- > >- > >- > >- > > > > > >- > >- > >type="tns:WSOrderHeader"/> >type="tns:ArrayOfWSOrderItem"/> > > >- > >- > > > > > > > > > > > > > > > > >type="s:string"/> > > > > > >- > >- > >nillable="true" type="tns:WSOrderItem"/> > > >- > >- > > > > > > >- > >- > >- > >type="tns:CreateOrderResponse"/> > > > >- > >- > > >type="s:string"/> >type="s:string"/> > > > > >- > > > >- > > > >- > >- > > > > > > > >- > >style="document"/> >- > > >- > > > >- > > > > > >- >type="tns:WebServiceOrderHttpGet"> > > >- >type="tns:WebServiceOrderHttpPost"> > > >- > > >- > > > >- >binding="tns:WebServiceOrderHttpGet"> > > >- >binding="tns:WebServiceOrderHttpPost"> > > > > > >----------end wsdl----------- > > > -- Marty Connelly Victoria, B.C. Canada From RRANTHON at sentara.com Fri Jul 29 13:06:33 2005 From: RRANTHON at sentara.com (Randall R Anthony) Date: Fri, 29 Jul 2005 14:06:33 -0400 Subject: [dba-VB] Common Dialogue to Open Files-Search Message-ID: <200507291806.j6TI6nR08115@databaseadvisors.com> Hi listers, Friday pm brain cramp, I can't seem to find the info for using the MS common dialogue control to create the M$ Office Open Files in an Access app I'm working on. Any help would be appreciated. I've used this before but can't find where I put it. Thanks! From martyconnelly at shaw.ca Fri Jul 29 14:40:02 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 29 Jul 2005 12:40:02 -0700 Subject: [dba-VB] Common Dialogue to Open Files-Search References: <200507291806.j6TI6nR08115@databaseadvisors.com> Message-ID: <42EA8612.5030703@shaw.ca> API: Call the standard Windows File Open/Save dialog box http://www.mvps.org/access/api/api0001.htm Or you can use Application.FileDialog in Access XP and higher and do multisect, open or save, however fails with runtimes. Sub test() 'needs reference to MS Office Object library ' No go with Runtime Dim dlgOpen As Object 'FileDialog Set dlgOpen = Application.FileDialog(msoFileDialogOpen) With dlgOpen .InitialFileName = "C:\" .Show End With 'or Dim strfile As String, fdObj As FileDialog Set fdObj = Application.FileDialog(msoFileDialogFilePicker) If fdObj.Show = -1 Then MsgBox fdObj.SelectedItems(1) Else MsgBox "You didn't select a file!" End If Set fdObj = Nothing End Sub Randall R Anthony wrote: >Hi listers, >Friday pm brain cramp, I can't seem to find the info for using the MS >common dialogue control to create the M$ Office Open Files in an Access >app I'm working on. Any help would be appreciated. I've used this >before but can't find where I put it. Thanks! >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From bkollodge at parkindustries.com Thu Jul 14 13:52:32 2005 From: bkollodge at parkindustries.com (Bill Kollodge) Date: Thu, 14 Jul 2005 13:52:32 -0500 Subject: [dba-VB] VB to VB via Ethernet Message-ID: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Hi folks, can anyone offer me direction or suggestions on how to enable 2 computers, each running their own VB application, to communicate to each other via Ethernet? I need to have one automated machine notify another when it is complete (or some other event happens). The machines run VB apps. Not sure where to even start. Any help/experience is greatly appreciated. Thanks, Bill Kollodge Software Engineering / CNC Products Park Industries St. Cloud, MN 56303 bkollodge at parkindustries.com This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. From sgsax at ksu.edu Thu Jul 14 14:12:34 2005 From: sgsax at ksu.edu (Seth Galitzer) Date: Thu, 14 Jul 2005 14:12:34 -0500 Subject: [dba-VB] VB to VB via Ethernet In-Reply-To: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> References: <37FC666D0E43984B9B96847A85F17213375855@VSEXCHANGE.parkindustries.com> Message-ID: <42D6B922.4010604@ksu.edu> Bill, As always, there are several ways to do this. I can think of two. 1) Write a TCP/IP client/server app. There are many examples for this on the web. You want to search for examples of using Windows Sockets in VB. With this method, you would write a server app which would listen on a port for a message from the client (which you would also write an app for). This message could be anything, from just a "done" message, to a periodic "status" message. 2) Create a shared directory on the "server" machine. On the "client" machine, when it finishes its task, write to a file on the server's shared directory, either using the full UNC path or map a drive letter to the location on the server. On the server, write an app that looks in that directory for the existence of this file. You can either read from the file, or just check to see if it exists. Once you've determined the status, either delete the file or reset its contents using the server app. Of these two methods, 2) would probably be easier, since it's only using built-in file and directory I/O methods and would require no new programming skills (like using Windows Sockets), but 1) would be more fun, as you would get to learn new programming skills (like using Windows Sockets). Seth Bill Kollodge wrote: > Hi folks, can anyone offer me direction or suggestions on how to enable > 2 computers, each running their own VB application, to communicate to > each other via Ethernet? > > I need to have one automated machine notify another when it is complete > (or some other event happens). The machines run VB apps. Not sure > where to even start. Any help/experience is greatly appreciated. > > Thanks, > > Bill Kollodge > Software Engineering / CNC Products > Park Industries > St. Cloud, MN 56303 > bkollodge at parkindustries.com > > > > This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of the e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail from your system. This e-mail does not constitute consent to the use of the sender's contact information for direct marketing purposes or for transfers of data to third parties. > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From jwcolby at colbyconsulting.com Thu Jul 21 13:50:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Thu, 21 Jul 2005 14:50:00 -0400 Subject: [dba-VB] VBExpress videos Message-ID: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From accessd at shaw.ca Thu Jul 21 14:02:12 2005 From: accessd at shaw.ca (Jim Lawrence) Date: Thu, 21 Jul 2005 12:02:12 -0700 Subject: [dba-VB] VBExpress videos In-Reply-To: <000501c58e25$02a3a3a0$6c7aa8c0@ColbyM6805> Message-ID: <0IJZ00C18RJK5W@l-daemon> Thanks for the info. John -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Thursday, July 21, 2005 11:50 AM To: VBA; AccessD Subject: [dba-VB] VBExpress videos In case you haven't found them, there is a beta available for VBExpress which is really just VB.Net light version, with its own IDE instead of being embedded in Visual Studio. The IDE looks and feels almost identical to the Visual Studio however. http://lab.msdn.microsoft.com/express/beginner/ Once you download and install the VBExpress notice the videos available. I discovered this guy a couple of years ago but he has now done (some) videos for this VBExpress and I am finding them very useful I think they would allow anyone who frequents this board to get up to speed pretty quickly, and I have to tell you, VBExpress.net is waaay cool. The videos will show you how to do stuff in the user interface (all that I have gotten to so far) that we can only dream of in VBA. Check it out - it looks very good to me. I am working through the video series right now. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 06:27:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 07:27:15 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <0IJZ00C18RJK5W@l-daemon> Message-ID: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jdemarco at hudsonhealthplan.org Fri Jul 22 06:53:43 2005 From: Jdemarco at hudsonhealthplan.org (Jim DeMarco) Date: Fri, 22 Jul 2005 07:53:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <08F823FD83787D4BA0B99CA580AD3C74016C3BA3@TTNEXCHCL2.hshhp.com> John, I don't have an example handy at the moment but I believe you can walk the records in a given table in a Dataset object. I may have something here to show you if I get a chance to look around later. Jim DeMarco -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". *********************************************************************************** From mikedorism at verizon.net Fri Jul 22 07:10:43 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 08:10:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001601c58eb0$4fc9a310$6c7aa8c0@ColbyM6805> Message-ID: <000001c58eb6$63215c90$2f01a8c0@dorismanning> In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 07:30:48 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 08:30:48 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000001c58eb6$63215c90$2f01a8c0@dorismanning> Message-ID: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:07:40 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:07:40 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001701c58eb9$340f2970$6c7aa8c0@ColbyM6805> Message-ID: <000101c58ebe$57b75410$2f01a8c0@dorismanning> The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 08:08:33 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 14:08:33 +0100 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: <200507221259.j6MCx6r13571@smarthost.yourcomms.net> Hi With a dataset you can do this Dim drows() as datarow = ds.tables(0).Select("ClientID = " & intID) to find a specific record Then can use drows.count or For each dRow in drows '' do something Next Both datareaders and datasets allow field references dr("ClientID") and ds("ClientID") Hope this helps Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 13:31 To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 08:24:37 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 09:24:37 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <000101c58ebe$57b75410$2f01a8c0@dorismanning> Message-ID: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 08:34:35 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 09:34:35 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: <001801c58ec0$b85e73f0$6c7aa8c0@ColbyM6805> Message-ID: <000201c58ec2$1a921cb0$2f01a8c0@dorismanning> I know what you mean. I had to piece it all out the hard way just like you are. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 9:25 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset I have a couple of books as well. Unfortunately they are all enamored with how easy it is to bind this thing to a control etc. and just aren't interested in discussing manipulating DATA directly - fields, records etc. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 9:08 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset The best way to filter, sort, or find records in ADO.Net is to use a DataView. You reference the variables by referring to the DataRow. VarName = dr("VarName").Value This website has several articles that should help clear up your confusion http://www.devarticles.com/c/b/ADO.NET/ There are also several books on the subject. I've got one put out by Microsoft Press ISBN 0735614237 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 8:31 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Alright, in this specific case it sounds like I need a data reader. However I am accustomed to working with datasets where you can "seek" or "find" specific records. So far I haven't found anything like that. The object loads all the records into an array apparently and then you can go to a specific row of the array, but only by the integer index. What am I missing? Is there not something similar to rst.find ([fieldname]=somevalue) And what about accessing the data by field name? MyVar = rst!VarName or MyVar = rst(VarName) Both of these constructs are just essential. How can you pull data out of specific fields of a table without such constructs unless you work with ordinal field positions which we have all been trained NEVER to do? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 8:11 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset In .Net, you use DataAdapters, Datasets, and DataReaders to work with data. A DataAdapter has Select, Insert, Update, and Delete commands. You use the DataAdapter to fill a Dataset. A Dataset can contain as many tables as you like. Each Table is indexed according to the order it is added to the dataset. A DataReader is a forward only dataset used when you just want to read through the data once. To work with the individual rows of a dataset, you would do the following. Dim dt as Table 'Variable to hold the Dataset table you want to work with Dim dr as Row 'Variable to refer to the row in the Dataset table. Dt = ds.Tables(0) 'Set the DataTable variable to the Dataset table For Each dr in dt 'Loop through the rows in the dataset 'Do something 'Do something Next dr 'Advance to the next row Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:54:28 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:54:28 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, I think what you are looking for is a filter. Google 'ado recordset filter' Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 08:57:34 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 09:57:34 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:04:00 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:04:00 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001901c58ec6$35ad3620$6c7aa8c0@ColbyM6805> Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:14:24 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:14:24 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From marcus at tsstech.com Fri Jul 22 09:18:42 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:18:42 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: This website gives an overview of ADO.Net and vb.net. http://www.programmersheaven.com/articles/patrik/Hierarchical.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 09:21:43 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 10:21:43 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset In-Reply-To: Message-ID: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 09:37:59 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 10:37:59 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: John, Also have a look at DataViews. Scott -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 9:58 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset http://www.programmingmsaccess.com/FAQs/Recordsets.htm -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 7:27 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Vb.net ADO Equivelent to recordset I need to manipulate a recordset like I would in VBA with rst .findfirst SomeVar = !SomeField SomeVar2 = !SomeField2 end with What is the equivalent in ADO / .net? I do not need to bind this to a control, and all of the examples I am finding for .NET assume I just want to bind it to a grid or a list or something. In fact I do want to bind it to a class if that is possible. I am building a class pair where one class represents an individual record, and the parent class represents a table (an indexed collection of the record classes). The first class has properties (variables) for each field in the table, and the init will load the values in. The second class needs to open the "recordset", and then start instantiating the first class, initializing with data from a given record, storing in a collection and moving to the next record. I have done all of this in ADO in VBA using the adodb.recordset object but don't find the equivalent in .net. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From marcus at tsstech.com Fri Jul 22 10:02:39 2005 From: marcus at tsstech.com (Scott Marcus) Date: Fri, 22 Jul 2005 11:02:39 -0400 Subject: [dba-VB] Vb.net ADO Equivelent to recordset Message-ID: Bear in mind that I could have called the Reader object 'rst'(or any valid variable name, Reader is not a reserved word) and the code would be exactly the same. That's why it was a little confusing what you were asking. Plus I jumped in the middle of the thread. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:22 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset This While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Was what I was looking for. Apparently the column is the "default property" for the reader object. Thus Reader("SomeFldName") is "the same as" rst("FieldName") from ADO. It is absolutely insane how much time it takes to get up to speed on a new object model. Speaking of which, does anyone have a good source for a hypertext object model diagram for .net, that shows the object model graphically but allows drilling down to look at the pieces? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Scott Marcus Sent: Friday, July 22, 2005 10:14 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Does this help in any way? Private Function GetEmployeeType() As DataTable Dim Conn As New SqlConnection(SQLConnStr) Dim Cmd As SqlCommand Dim Reader As SqlDataReader Dim SQL As String Dim TypeTable As New DataTable Dim empColumn As DataColumn Dim KeyColumns(1) As DataColumn Dim dvEmployees As DataView Dim rowVals(1) As Object empColumn = New DataColumn("EMPNO", GetType(String)) TypeTable.Columns.Add(empColumn) KeyColumns(0) = empColumn TypeTable.PrimaryKey = KeyColumns TypeTable.Columns.Add("TYPE", GetType(Integer)) 'Returns the employee type (8 or 10) for hours in a given week an employee works per day SQL = "SELECT RIGHT('000' + LTRIM(RTRIM(EMPLOYEENO)),4) AS EMPNO, JOB_CODE FROM TOOL..VISIB.EMPLOYEES WHERE STATUS = 'A' AND (JOB_CODE = '8' OR JOB_CODE = '10') ORDER BY EMPNO" Conn.Open() Cmd = New SqlCommand(SQL, Conn) Reader = Cmd.ExecuteReader While Reader.Read() rowVals(0) = Reader("EMPNO") rowVals(1) = Reader("JOB_CODE") ' Add and return the new row. TypeTable.Rows.Add(rowVals) End While Conn.Close() GetEmployeeType = TypeTable End Function -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 10:04 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Vb.net ADO Equivelent to recordset Thanks Scott, but I am looking for the equivalent syntax in .NET. I already know how to do this in ado in Access. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 10:23:38 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 11:23:38 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001a01c58ec8$af680380$6c7aa8c0@ColbyM6805> Message-ID: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From mikedorism at verizon.net Fri Jul 22 10:35:11 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 11:35:11 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From R.Griffiths at bury.gov.uk Fri Jul 22 11:09:18 2005 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Fri, 22 Jul 2005 17:09:18 +0100 Subject: [dba-VB] Add executable solution to project Message-ID: <200507221559.j6MFxor27655@smarthost.yourcomms.net> Hi I think if you add the project (which contains the code in the dll) to your solution you can then debug the dll code - you can then set a reference in your main project/solution to reference that project (as opposed to the dll) HTH Richard -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: 22 July 2005 16:24 To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:24:15 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:24:15 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000301c58ed2$f35e7f60$2f01a8c0@dorismanning> Message-ID: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Fri Jul 22 11:35:14 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Fri, 22 Jul 2005 12:35:14 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <002001c58ed9$cd3dbd30$6c7aa8c0@ColbyM6805> Message-ID: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Fri Jul 22 11:45:19 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Fri, 22 Jul 2005 12:45:19 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <000401c58edb$5729daf0$2f01a8c0@dorismanning> Message-ID: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Yes, but as soon as I do that, then I am right back to the "namespace system.data cannot be found". For some reason, the namespaces I use in that class library are valid in a "class library" but are not valid in a "Windows Application". John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 12:35 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Sorry. That trick does work with a homegrown User Control dll. This will definitely work...Add an Existing Item to your project. Navigate to where your class object code module is. Select it and hit the down arrow next to the "Open" button. Choose "Link File" and it will connect that code module to the current project. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 12:24 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project >Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. Not working here. I am taken to the object browser and shown the properties and methods of the object, but not the object. I referenced the DLL however. I did not see a way to reference the actual "source" (project). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Friday, July 22, 2005 11:35 AM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Add executable solution to project Do your debugging work on the class through the project that references them. Just right click on a property or method of the class object and choose "Definition". You will then be taken to the class itself. The really cool part about all this is that any changes you make to the class object will automatically be picked up by any other project that references that class dll. Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 06:42:53 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 07:42:53 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <002101c58edc$c1fd9d20$6c7aa8c0@ColbyM6805> Message-ID: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:14:49 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:14:49 -0400 Subject: [dba-VB] .net correct version of jet Message-ID: <000d01c59049$49ec9160$6c7aa8c0@ColbyM6805> I am using the following code to set up a connection. Public Sub New(ByVal lstrMDBFileSpec As String, ByVal lstrTblName As String) Dim mstrCnnJet As String = "Provider=Microsoft.Jet.OLEDB.4.0;" mstrCnn = mstrCnnJet & lstrMDBFileSpec mstrTblName = lstrTblName LoadSysVars(mstrCnn) End Sub The code passes in a filespec for an MDB container that a table resides in and the table name. Inside new() the mstrcnn is built up by appending mstrCnnJet and lstrMDBFileSpec. This works but it seems that I am getting awfully specific in mstrCnnJet. Is there a way to determine what version of Microsoft.Jet.OLEDB is available on the machine that the code is running on? Or is this a non-issue as there is only (and will only ever be) one version (4.0)? John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 07:36:36 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 08:36:36 -0400 Subject: [dba-VB] Add executable solution to project In-Reply-To: <001d01c58ed1$5926a0e0$6c7aa8c0@ColbyM6805> Message-ID: <000e01c5904c$552c5490$6c7aa8c0@ColbyM6805> Well... This was all caused by a lack of understanding of imports and references. I just needed to reference the right object (namespace?). I still haven't gotten back to this point but I do have all of my collection and oledb code working. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Friday, July 22, 2005 11:24 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] Add executable solution to project I am working on a set of classes in a project which need Imports System.Data.OleDb Imports System.Data Imports System.Collections I was developing them in a class library, and all is cool. However I can't just throw a form in there and run the thing to test it, I get a "cannot be started directly" error. So... I tried just copying the classes (all in one module, THAT is cool) into a window project. Of course(?) now the imports don't work. Sigh. So I created a Window project and referenced the dll from my class library. That is cool as well, however... I really want to interactively debug the class library. The error message when trying to run the class library code (directly) says to "add an executable project to this solution which references the library project". I can't seem to find any way to directly add my window project (which references the class library) to the class library solution. Anybody know how to do this? This BTW is exactly why I have never gotten anywhere with .net so far. I promptly get bogged down in details with no readily available help. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 08:55:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 09:55:25 -0400 Subject: [dba-VB] Connection strings for ado Message-ID: <000f01c59057$5abb3560$6c7aa8c0@ColbyM6805> I found this: http://www.connectionstrings.com/ John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 09:36:03 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 10:36:03 -0400 Subject: [dba-VB] .Net Strategies for classes connecting to data Message-ID: <000001c5905d$083c3950$6c7aa8c0@ColbyM6805> I have designed a class system for my Sysvars. I have it working for connecting to data in MDB files, however I am now looking to make it general enough to load data out of different types of data stores. Should I: 1) Just require the class user (programmer) to build their connection string, accept the connection string and load the data. 2) Overload the new() constructor to allow different methods where I build up the connection strings based on passed in pieces. 3) Allow the programmer to inherit the class and build a new() that does that final piece however they want. I want the class to be "just usable" with an Access BE (for my own purposes). OTOH, I also want to be able to use the class for connecting to SQL Server or XML files (specifically) without too much bother. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From ebarro at afsweb.com Sun Jul 24 11:12:20 2005 From: ebarro at afsweb.com (Eric Barro) Date: Sun, 24 Jul 2005 09:12:20 -0700 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000c01c59044$d80836c0$6c7aa8c0@ColbyM6805> Message-ID: John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. From jwcolby at colbyconsulting.com Sun Jul 24 11:40:25 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 12:40:25 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000101c5906e$679c0e50$6c7aa8c0@ColbyM6805> Thanks for that tip. I'll start doing it that way. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From mikedorism at verizon.net Sun Jul 24 13:29:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Sun, 24 Jul 2005 14:29:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: Message-ID: <000001c5907d$952be200$2e01a8c0@dorismanning> In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Eric Barro Sent: Sunday, July 24, 2005 12:12 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings John, I would change the code to read as... Dim str As New StringBuilder For Each lstcSysVar In Me.List str.Append(" " & lstcSysVar.pValue.ToString) Next Return str.ToString() The StringBuilder class is more efficient than the old string concatenation routines in classic VB. Eric -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 4:43 AM To: dba-vb at databaseadvisors.com Subject: [dba-VB] .net piddly warnings I am getting a lot of warnings like Variable Umptiumpt used before it is assigned a value. The following code causes such a warning: Dim str As String For Each lstcSysVar In Me.List str = str & " " & lstcSysVar.pValue.ToString Next Return str This is quite common methodology and would require the quite unnecessary str = "" After the dim statement to avoid the warning. Is there any way to acknowledge the warning and cause it to go away, preferably for specific instances (lines) of code? It seems that unless you just always do the variable initialization you are going to end up with hundreds of useless warnings masking real warnings that you wish to be made aware of. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ---------------------------------------------------------------- The information contained in this e-mail message and any file, document, previous e-mail message and/or attachment transmitted herewith is confidential and may be legally privileged. It is intended solely for the private use of the addressee and must not be disclosed to or used by anyone other than the addressee. If you receive this transmission by error, please immediately notify the sender by reply e-mail and destroy the original transmission and its attachments without reading or saving it in any manner. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Users and employees of the e-mail system are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy. The company will not accept any liability in respect of such communication. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From jwcolby at colbyconsulting.com Sun Jul 24 19:45:41 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 20:45:41 -0400 Subject: [dba-VB] XML Serialization Message-ID: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Well I made my base SysVar structure serializable and created a SerializeOut and SerializeIn in the SysVar collection class and voila, exports / imports of sysvars to XML files. Cool stuff. This means that I can now store SysVars in either an MDB or XML files. It "only" took FOUR days to figure all this stuff out starting with working VBA ADO classes in Access. One more class and I will have the full SysVar functionality that I had inside of VBA. The upside though is that learning how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation (and working examples) for much of the data manipulation stuff that I "just knew how to do" in VBA. So many properties/methods, so little time. And serialization to/from XML is pretty darned cool as well. I've only scratched the surface on that stuff. I must say I don't know what I would do without the internet though. I own one pretty good VB.Net book and three different ADO.Net books ad it is still waaaay faster to just Google for example code. Once I have working example code it is easy enough to pick up and understand what is going on. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From jwcolby at colbyconsulting.com Sun Jul 24 20:16:57 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Sun, 24 Jul 2005 21:16:57 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000001c5907d$952be200$2e01a8c0@dorismanning> Message-ID: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. From mikedorism at verizon.net Mon Jul 25 08:50:07 2005 From: mikedorism at verizon.net (Mike & Doris Manning) Date: Mon, 25 Jul 2005 09:50:07 -0400 Subject: [dba-VB] .net piddly warnings In-Reply-To: <000b01c590b6$90433b60$6c7aa8c0@ColbyM6805> Message-ID: <000501c5911f$c4fbd7e0$2e01a8c0@dorismanning> John, This website has a lot of really good tutorials. Take a look at #6 for info on structures. You can definitely do what you are trying to with a structure. http://www.programmersheaven.com/2/VB-NET-School Doris Manning Database Administrator Hargrove Inc. -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of John W. Colby Sent: Sunday, July 24, 2005 9:17 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings Doris, I decided to make my SysVar data object a structure rather than a class. I haven't really decided whether that was a good idea or not, but the structure for a SysVar just holds 6 pieces of data: The PKID from the table - Long The SysVar name - String The SysVar value - Object The SysVar memo - String And a pair of boolean flags - UserEditable and AllowOverride I have run into a handful of places in the past where I built a system where I would load a table, each record represented by a data class, and a collection class that holds a data class instance for every record in the table. SysVars is one of these places. So it seemed that a structure was a good idea for the data class. However I still wanted a single method in the data class that I called to initialize every variable in the data class, passing in (in this case) all 6 pieces of data from a record to the data class. Thus the data class init code looked something like: Public Sub Init(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) mintID = lintID mstrName = lstrName.ToLower mobjValue = lobjValue mstrMemo = lstrMemo.ToLower mblnUserEditable = lblnUserEditable mblnAllowOverride = lblnAllowOverride End Sub With the collection class method that creates these things looked something like: mOleDBReader = mOleDBCmd.ExecuteReader With mOleDBReader While .Read NewSysVar(mOleDBReader("SV_ID"), mOleDBReader("SV_VarName"), mOleDBReader("SV_VarValue"), mOleDBReader("SV_Memo"), mOleDBReader("SV_UserEditable"), mOleDBReader("SV_AllowOverride")) End While End With Public Sub NewSysVar(ByVal lintID As Int32, ByVal lstrName As String, ByVal lobjValue As Object, ByVal lstrMemo As String, _ ByVal lblnUserEditable As Boolean, ByVal lblnAllowOverride As Boolean) Dim lSysVar As stcSysVar lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Add(lSysVar) End Sub The line: lSysVar.Init(lintID, lstrName, lobjValue, lstrMemo, lblnUserEditable, lblnAllowOverride) Gives me this error I am discussing - "lSysVar is used before it is assigned a value." This is one reason I am not sure that the Structure is necessarily better than a class at least in this case. If I had a class I would just have a New() constructor that I fed the data values into. A structure doesn't have a New (or a constructor), and it "expects" that each data item of the structure would be accessed individually, set, and then read. Because I call a method with all values at once, I never "set" a property first and I get this annoying error that never goes away. Sigh. Yea, I could set a property just to cause the error message to go away but I don't want to. I could also have gotten rid of NewSysVar and just done each property individually, but I don't want to. John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris Manning Sent: Sunday, July 24, 2005 2:29 PM To: ebarro at afsweb.com; dba-vb at databaseadvisors.com Subject: RE: [dba-VB] .net piddly warnings In VB.Net, you can combine the declaration and the initialization on one line as follows: Dim str as String = vbNullString Dim bol as Boolean = False Dim int as Integer = 0 Doris Manning Database Administrator Hargrove Inc. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From martyconnelly at shaw.ca Mon Jul 25 11:48:20 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Mon, 25 Jul 2005 09:48:20 -0700 Subject: [dba-VB] XML Serialization References: <000a01c590b2$322f0d50$6c7aa8c0@ColbyM6805> Message-ID: <42E517D4.5020008@shaw.ca> I don't know if you are using ado streams to ouput or input an ado recordset as an xml file but here is some really rough test code I was running from Access97. I was using to debug Google's desktop search engines output of UTF-8 xml via Access There is code here to check the proper BOM marker on XML and also convert the output xml from the ado stream to different encoding types UTF-8, Unicode, ISO-8859-1, Big-5 etc. I also use this method to convert xml files to and fro from UTF-8 to UTF-16 encoding. UTF-8 being a mangled compression of UTF-16 with one caveat if the original xml characters aren't properly escaped such as Windows typographical chars they will be dropped by the conversion. This is a problem with the XML google pumps out. especially with international chars. Maybe there are enough notes to puzzle it out or give you somethings to consider. Sub ReadFileInUTF16() '1 LoadFromFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" MsgBox stm.ReadText End Sub Sub SaveFileinUTF8() '2 SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub ReadSaveFileInUTF8() '1/2 ReadToFile / SaveToFile snippet Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.LoadFromFile strPath & "encUTF8.xml" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub TranlateToUTF8() '3 charset snippet 'ERROR Don't Use this code, just to expose the google error Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.LoadFromFile strPath & "encUTF16.xml" stm.Charset = "UTF-8" stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite End Sub Sub PersistStreamToXML() Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim stm As ADODB.stream Dim strPath As String strPath = GetPath(CurrentDb.Name) Set cnn = New ADODB.Connection cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & CurrentDb.Name & ";" Set rst = New ADODB.Recordset rst.Open "SELECT * FROM tblTest", cnn Set stm = New ADODB.stream rst.Save stm, adPersistXML rst.Close Set rst = Nothing MsgBox stm.Charset stm.SaveToFile strPath & "test.xml", adSaveCreateOverWrite Set stm = Nothing End Sub Sub ReadUTF8SaveFileInUTF16test() '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx Dim stm As ADODB.stream Dim strPath As String Dim strData As String strPath = GetPath(CurrentDb.Name) Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" stm.Position = 0 stm.Type = adTypeText 'stm.LoadFromFile strPath & "encUTF8.xml" stm.LoadFromFile "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml" ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 strData = stm.ReadText() Debug.Print strData stm.Position = 0 stm.Charset = "Unicode" ' "Unicode" '"ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strPath & "test16.xml", adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\UTF-8 encoded XML\Xm8w\XM8\XM8_UTF_vb\XM8_UTF_vb.xml", ' ReadUTF8SaveFileInUTF16 "C:\XML\Gil Encodings\XM8_UTF_vb.xml","C:\XML\Gil Encodings\test16.xml" Sub ReadUTF8SaveFileInUTF16(strFileIn As String, strFileOut As String) '1/2 ReadToFile / SaveToFile snippet 'http://www.codeproject.com/soap/XMJFileStreaming.asp?msg=841289&mode=all&userid=903408#xx767979xx 'used ado 2.7 Dim stm As ADODB.stream Dim strPath As String Dim strData As String 'the character set encoding names for the machine are in the registry 'For a list of the character set strings that is known by a system, see 'the subkeys of HKEY_CLASSES_ROOT\MIME\Database\Charset 'in the Windows Registry. Set stm = New ADODB.stream stm.Open stm.Charset = "UTF-8" 'input file character set stm.Position = 0 stm.Type = adTypeText ' stm.LoadFromFile strFileIn ' if you just try and dump out stream ' without reading and writing you get double BOM stm.Position = 0 'reset to beginning of stream Dim strDataout strData = stm.ReadText() ' line below used to change encoding instruction for xml files ' 'strData = Replace(strData, "utf-8", "UTF-16", 1, 1) strData = Replace(strData, "utf-8", "UTF-16", 1, 1) Debug.Print strData stm.Position = 0 ' set output file character set stm.Charset = "UTF-16" ' "Unicode" '"iso-8859-1" "ascii" '"Big5" '"hebrew" stm.WriteText (strData) stm.SaveToFile strFileOut, adSaveCreateOverWrite stm.Close Set stm = Nothing End Sub Public Function Replace(strIn As Variant, strFind As String, _ strReplace As String, Optional intStart As Integer = 1, _ Optional intCount As Integer = -1, _ Optional intCompare As Integer = 0) As String '----------------------------------------------------------- ' Inputs: String to search and replace, ' search string, replacement string, ' optional starting position (default = 1), ' optional replacement limit (default = -1 .. ALL) ' optional string compare value (default = 0 .. vbBinaryCompare) ' Outputs: Replaced string ' Created By: JLV 09/05/01 ' Last Revised: JLV 09/05/01 ' ** Duplicates the functionality of the VB 6 REPLACE function. '----------------------------------------------------------- Dim strWork As String, intS As Integer, intCnt As Integer Dim intI As Integer, intLenF As Integer, intLenR As Integer If (intCompare < 0) Or (intCompare > 2) Then Err.Raise 5 Exit Function End If If VarType(strIn) <> vbString Then Err.Raise 5 Exit Function End If strWork = strIn intS = intStart intCnt = intCount intLenF = Len(strFind) intLenR = Len(strReplace) ' If find string zero length or count is zero, then nothing to replace If (intLenF = 0) Or (intCnt = 0) Then Replace = strIn Exit Function End If ' If start beyond length of string, return empty string If intS > Len(strWork) Then Replace = "" Exit Function End If ' Got some work to do -- find strings to replace Do intI = InStr(intS, strWork, strFind, intCompare) If intI = 0 Then Exit Do ' Insert the replace string strWork = Left(strWork, intI - 1) & strReplace & Mid(strWork, intI + intLenF) intS = intS + intI + intLenR - 1 ' Bump start to end of the replace string intCnt = intCnt - 1 ' Decrement the max replace counter Loop Until intCnt = 0 Replace = strWork End Function Public Function GetPath(ByVal strFilePath As String) As String Dim s As String Dim i As Integer For i = Len(strFilePath) To 1 Step -1 s = Mid$(strFilePath, i, 1) If StrComp(s, "\", vbBinaryCompare) = 0 Then GetPath = Left$(strFilePath, i) Exit For End If Next End Function Sub CheckBOM(Optional strFileIn As Variant, Optional strIn As Variant) 'checkbom "C:\XML\Gil Encodings\encUTF8_NoDecl.xml" On Error GoTo Err_handler Dim strInputData As String * 4 Dim lpBuffer() As Byte Dim intFreeFile As Integer If Not IsMissing(strFileIn) Then intFreeFile = FreeFile Open strFileIn For Binary Access Read Lock Read As #intFreeFile Len = 4 ReDim lpBuffer(4) Get #intFreeFile, , lpBuffer Close #intFreeFile ElseIf Not IsMissing(strIn) Then 'Can't makes this work since VBA is always converting the string to UTF-16LE lpBuffer = Left$(strIn, 4) Else MsgBox "Nothing To Do" Exit Sub End If If lpBuffer(0) = 255 And lpBuffer(1) = 254 Then Debug.Print "File is UTF-16 Little Endian" ElseIf lpBuffer(0) = 254 And lpBuffer(1) = 255 Then Debug.Print "File is UTF-16 Big Endian" ElseIf lpBuffer(0) = 239 And lpBuffer(1) = 187 And lpBuffer(2) = 191 Then Debug.Print "File is UTF-8" 'Start trying to figure out by other means this will only work on xml files that start with "= 128 And lngUCS_dec < 2048 Then bytOne = 192 + (lngUCS_dec \ 64) bytTwo = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo)) ElseIf lngUCS_dec >= 2048 And lngUCS_dec < 65536 Then bytOne = 224 + (lngUCS_dec \ 4096) bytTwo = 128 + ((lngUCS_dec \ 64) Mod 64) bytThree = 128 + (lngUCS_dec Mod 64) EncodeToUTF8 = CStr("0x" & Hex(bytOne) & Hex(bytTwo) & Hex(bytThree)) Else MsgBox "Character Out of Range" End If End Function John W. Colby wrote: >Well I made my base SysVar structure serializable and created a SerializeOut >and SerializeIn in the SysVar collection class and voila, exports / imports >of sysvars to XML files. Cool stuff. This means that I can now store >SysVars in either an MDB or XML files. > >It "only" took FOUR days to figure all this stuff out starting with working >VBA ADO classes in Access. One more class and I will have the full SysVar >functionality that I had inside of VBA. The upside though is that learning >how to read/write (manipulate) ADO.Net OLEDB objects gives me the foundation >(and working examples) for much of the data manipulation stuff that I "just >knew how to do" in VBA. So many properties/methods, so little time. And >serialization to/from XML is pretty darned cool as well. I've only >scratched the surface on that stuff. > >I must say I don't know what I would do without the internet though. I own >one pretty good VB.Net book and three different ADO.Net books ad it is still >waaaay faster to just Google for example code. Once I have working example >code it is easy enough to pick up and understand what is going on. > >John W. Colby >www.ColbyConsulting.com > >Contribute your unused CPU cycles to a good cause: >http://folding.stanford.edu/ > > >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada From jwcolby at colbyconsulting.com Mon Jul 25 18:17:45 2005 From: jwcolby at colbyconsulting.com (John W. Colby) Date: Mon, 25 Jul 2005 19:17:45 -0400 Subject: [dba-VB] Inheriting collections Message-ID: <000101c5916f$10e38230$6c7aa8c0@ColbyM6805> Being new to this inheritance thing (in the last 15 years), I have a conceptual question: In my SysVarRec I use a data class (or structure) that holds one record's worth of SysVar data from a specific table. I use a SysVarsTbl class that holds a collection of SysVarRec instances. This class loads all of the sysvar records from a single table, loading each record's data into a SysVarRec class or structure. I use a SysVars class which loads one or more instances of SysVarsTbl, storing each SysVarsTbl class into a collection. ADDITIONALLY, this class then merges all of the SysVarsTbl class' data into a single collection of SysVars. This collection is nothing more than a keyed collection, where the value is stored, with a key to index into the collection. The objective here is to allow several different copies of a SysVars table to exist, where the "last loaded wins". For example, suppose I have a SysVar called EnableZip, whose value is True/False. If True the Zip functionality is loaded as the framework sets up. In the framework's copy of tblSysVars, EnableZip exists but is set to false. Thus as the framework initializes, the zip functionality is not loaded. In the application's copy of tblSysVars, EnableZip is True because this application needs to zip files. The tables load Framework.tblSysVar and then Application.tblSysVars. EnableZip=false loads from the framework table, but then the EnableZip=True loads from the application table loads and "overrides" the framework's SysVar. What really happens is that the EnableZip is found already loaded and changed from False to True. Thus by the time the application table finishes loading, EnableZip is True and the zip functionality of the framework loads. Well, you get the idea anyway. Think up your own scenario. The question now is... Since a class can be inherited, should SysVarsTbl inherit the collection class so that all of the collection functionality is native to the SysVarsTbl class? Or should the SysVarsTbl class simply have a collection class variable that it sets up and loads an instance of the collection class? IOW, SysVarsTbl needs a collection but it could BE a collection or it could just dim and use a collection. VBA did not have this ability, so I became accustomed to just "consuming" collections, i.e. using them. But now the class that needs a collection could BE a collection class, with all of the functionality of the collection class inherited right in and specific non-collection functionality added to it (loading records out of a table for example). John W. Colby www.ColbyConsulting.com Contribute your unused CPU cycles to a good cause: http://folding.stanford.edu/ From Jeff at outbaktech.com Tue Jul 26 15:58:48 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 15:58:48 -0500 Subject: [dba-VB] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com From Jeff at outbaktech.com Tue Jul 26 21:27:15 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Tue, 26 Jul 2005 21:27:15 -0500 Subject: [dba-VB] RE: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Message-ID: Sorry, I should have been more specific. I was contacted by a recruiter who is looking for a .NET developer looking for a long term contract in Neenah, WI. The company is looking for 10 years experience in IT and at least 2 years experience with .NET. I was told that they are willing to relax their requirements a little for a 'local boy (or girl). If anyone is interested, please contact me off-list and I will send additional information, including the recruiters name and contact information. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com -----Original Message----- From: dba-ot-bounces at databaseadvisors.com [mailto:dba-ot-bounces at databaseadvisors.com] On Behalf Of Jeff Barrows Sent: Tuesday, July 26, 2005 3:59 PM To: dba-OT; Dba-Tech; dba-VB; AccessD Subject: [dba-OT] Cross Posted: Looking for a .NET developer near Neenah, WI Anybody looking for a .NET contract (12 months +)????? Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Racine, WI jeff at outbaktech.com _______________________________________________ dba-OT mailing list dba-OT at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-ot Website: http://www.databaseadvisors.com From Jeff at outbaktech.com Thu Jul 28 09:37:56 2005 From: Jeff at outbaktech.com (Jeff Barrows) Date: Thu, 28 Jul 2005 09:37:56 -0500 Subject: [dba-VB] RE: [dba-Tech] RE: [dba-OT] Cross Posted: Looking for a .NET developernear Neenah, WI Message-ID: I have already responded to one individual off-list. If anyone else is interested in additional information, please contact me directly at the email address in my signature. Jeff Barrows MCP, MCAD, MCSD Outbak Technologies, LLC Phone: 886-5913 Fax: 886-5932 Racine, WI jeff at outbaktech.com From fhtapia at gmail.com Thu Jul 28 16:47:34 2005 From: fhtapia at gmail.com (Francisco Tapia) Date: Thu, 28 Jul 2005 14:47:34 -0700 Subject: [dba-VB] SoapClient in VBscript Message-ID: I have a webservice which I will need to call fom a vbscript (in the end it will be a sp_OA type call, but for this purpose it's a vbscript... I'm looking at the wsdl file and I choose the "CreateOrder" method but I keep getting invalid parameter settings for it... (WSDL file sample included), my current example soap call looks like this: ---Soap---- Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") SOAPClient.mssoapinit (" http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") sxml = "
FO100 HFO-TEST 9002658 Div Of Test 7858 Thorndike Rd GreensBoro NC 27409 United States Test 8055551234 test 100 TEST9999
14-7068 15 21222
" Result = SOAPClient.CreateOrder(sxml) ---endSoap---- I keep getting this error: Server was unable to process request --->Object reference not set to an instance of an object, any ideas??? -----------wsdl----------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ----------end wsdl----------- -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspot.com | Tsql and More... From martyconnelly at shaw.ca Fri Jul 29 00:44:07 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Thu, 28 Jul 2005 22:44:07 -0700 Subject: [dba-VB] SoapClient in VBscript References: Message-ID: <42E9C227.3080409@shaw.ca> You might take two approaches to check for errors. 1. Using Access and the webservice wizard, point it at your wsdl and create the class code then move that to your vbscript.and call it. 2. use xmlhttp to fire your xml string at the wsdl and parse the returned xml. I have some basic code lying around to do this from VBA 3 Also check you have a valid wsdl file There are a few few of these validator sites on the web http://www.mgateway.com/scripts/mgwms32.dll?MGWLPN=EXTC&wlapp=wsdlValidator&eXtcCalledFrom=MGateway Also for ASP I think it should be which might be why it isn't finding the object Dim oSOAP Set oSOAPClient = Server.CreateObject("MSSOAP.So?apClient30") oSOAPClient.ClientProperty("ServerHT?TPRequest") = True ... blah blah Francisco Tapia wrote: >I have a webservice which I will need to call fom a vbscript (in the end it >will be a sp_OA type call, but for this purpose it's a vbscript... I'm >looking at the wsdl file and I choose the "CreateOrder" method but I keep >getting invalid parameter settings for it... (WSDL file sample included), my >current example soap call looks like this: > >---Soap---- >Set SOAPClient = CreateObject("MSSOAP.SOAPClient30") >SOAPClient.mssoapinit (" >http://Sampleweb2:8085/AWDev/webservice/webserviceorder.asmx?wsdl") > >sxml = "
FO100 >HFO-TEST 9002658 >Div Of Test 7858 Thorndike Rd > GreensBoro NC 27409 >United States Test >8055551234 test 100 >TEST9999 />
14-7068 >15 21222 >
" > >Result = SOAPClient.CreateOrder(sxml) > >---endSoap---- > >I keep getting this error: Server was unable to process request --->Object >reference not set to an instance of an object, any ideas??? > >-----------wsdl----------------- >- > >- > >- > >- > >- > >- > > > > > >- > >- > >type="tns:WSOrderHeader"/> >type="tns:ArrayOfWSOrderItem"/> > > >- > >- > > > > > > > > > > > > > > > > >type="s:string"/> > > > > > >- > >- > >nillable="true" type="tns:WSOrderItem"/> > > >- > >- > > > > > > >- > >- > >- > >type="tns:CreateOrderResponse"/> > > > >- > >- > > >type="s:string"/> >type="s:string"/> > > > > >- > > > >- > > > >- > >- > > > > > > > >- > >style="document"/> >- > > >- > > > >- > > > > > >- >type="tns:WebServiceOrderHttpGet"> > > >- >type="tns:WebServiceOrderHttpPost"> > > >- > > >- > > > >- >binding="tns:WebServiceOrderHttpGet"> > > >- >binding="tns:WebServiceOrderHttpPost"> > > > > > >----------end wsdl----------- > > > -- Marty Connelly Victoria, B.C. Canada From RRANTHON at sentara.com Fri Jul 29 13:06:33 2005 From: RRANTHON at sentara.com (Randall R Anthony) Date: Fri, 29 Jul 2005 14:06:33 -0400 Subject: [dba-VB] Common Dialogue to Open Files-Search Message-ID: <200507291806.j6TI6nR08115@databaseadvisors.com> Hi listers, Friday pm brain cramp, I can't seem to find the info for using the MS common dialogue control to create the M$ Office Open Files in an Access app I'm working on. Any help would be appreciated. I've used this before but can't find where I put it. Thanks! From martyconnelly at shaw.ca Fri Jul 29 14:40:02 2005 From: martyconnelly at shaw.ca (MartyConnelly) Date: Fri, 29 Jul 2005 12:40:02 -0700 Subject: [dba-VB] Common Dialogue to Open Files-Search References: <200507291806.j6TI6nR08115@databaseadvisors.com> Message-ID: <42EA8612.5030703@shaw.ca> API: Call the standard Windows File Open/Save dialog box http://www.mvps.org/access/api/api0001.htm Or you can use Application.FileDialog in Access XP and higher and do multisect, open or save, however fails with runtimes. Sub test() 'needs reference to MS Office Object library ' No go with Runtime Dim dlgOpen As Object 'FileDialog Set dlgOpen = Application.FileDialog(msoFileDialogOpen) With dlgOpen .InitialFileName = "C:\" .Show End With 'or Dim strfile As String, fdObj As FileDialog Set fdObj = Application.FileDialog(msoFileDialogFilePicker) If fdObj.Show = -1 Then MsgBox fdObj.SelectedItems(1) Else MsgBox "You didn't select a file!" End If Set fdObj = Nothing End Sub Randall R Anthony wrote: >Hi listers, >Friday pm brain cramp, I can't seem to find the info for using the MS >common dialogue control to create the M$ Office Open Files in an Access >app I'm working on. Any help would be appreciated. I've used this >before but can't find where I put it. Thanks! >_______________________________________________ >dba-VB mailing list >dba-VB at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-vb >http://www.databaseadvisors.com > > > > > -- Marty Connelly Victoria, B.C. Canada