From jwcolby at colbyconsulting.com Mon Sep 10 12:03:41 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 10 Sep 2007 13:03:41 -0400 Subject: [dba-VB] Driver for GPS sensor Message-ID: <001901c7f3cc$8acce430$6c7aa8c0@M90> I am trying to find VB (preferably) software to directly read the GPS-500 SiRF III GPS sensor that comes with MS streets and trips. I just bought my first telescope and now want to start looking at GPS locator info to feed existing "push to" software. John W. Colby Colby Consulting www.ColbyConsulting.com From Gustav at cactus.dk Wed Sep 19 08:01:33 2007 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 19 Sep 2007 15:01:33 +0200 Subject: [dba-VB] VS2005: Create a rectangle in a PictureBox Message-ID: Hi all I have a form with a PictureBox, and I can load a picture from a file into this. Now I wish to mark (select) a rectangle somewhere inside the picture - you know: mouse-down to mark upper-left corner, draw mouse to lower-right corner, release mouse button - and save the picture with the created rectangle overlayed. Any suggestions on how to achieve this? /gustav From jwcolby at colbyconsulting.com Fri Sep 21 10:38:32 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 11:38:32 -0400 Subject: [dba-VB] Bulk Insert Error. Message-ID: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Fri Sep 21 13:13:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 14:13:14 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> References: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> Message-ID: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From max.wanadoo at gmail.com Fri Sep 21 13:22:53 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Fri, 21 Sep 2007 19:22:53 +0100 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Message-ID: <003f01c7fc7c$6d607250$8119fea9@LTVM> I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver 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 Sep 21 14:36:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 15:36:51 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <003f01c7fc7c$6d607250$8119fea9@LTVM> References: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> <003f01c7fc7c$6d607250$8119fea9@LTVM> Message-ID: <00a901c7fc86$c2d5fed0$6c7aa8c0@M90> ROTFL. Naw, I'm still a complete nubee and so any suggestion is better than what I know. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Friday, September 21, 2007 2:23 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Thu Sep 27 13:33:54 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:33:54 -0400 Subject: [dba-VB] Use Regex - Create Camel Case Message-ID: <005801c80134$f60b9320$6c7aa8c0@M90> Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com From max.wanadoo at gmail.com Thu Sep 27 13:46:52 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 19:46:52 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <00c401c80136$c66049c0$8119fea9@LTVM> John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 Thu Sep 27 13:59:38 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:59:38 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <00c401c80136$c66049c0$8119fea9@LTVM> References: <005801c80134$f60b9320$6c7aa8c0@M90> <00c401c80136$c66049c0$8119fea9@LTVM> Message-ID: <005901c80138$8e73cfd0$6c7aa8c0@M90> LOL, well, that is certainly an option. In fact I am currently doing something similar and realized that I had done a simple substitution. However... I am also getting things like APN SEQUENCE NUMBER. I really want to remove the space and camel case what is left. ApnSequenceNumber. Of course this ignores that APN is an acronym but I cannot really know that. These field names come at me from all angles and I just want to standardize the results so that my tables have readable field names. I am hearing about RegEx, in fact from our group members, so I thought perhaps someone either already had this laying around, or at least had the familiarity to knock one out and explain it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Thursday, September 27, 2007 2:47 PM To: dba-vb at databaseadvisors.com; 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 ridermark at gmail.com Thu Sep 27 14:01:53 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:01:53 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Thu Sep 27 14:09:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 15:09:51 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <005a01c80139$fb68eb60$6c7aa8c0@M90> I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From ridermark at gmail.com Thu Sep 27 14:22:01 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:22:01 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Check out that site on regular expressions - that helped me out a lot. I have a similar situation where the data feed that we get may or may not have everything we want, and almost ALWAYS has more than we are expecting. RegEx has saved me a lot of headaches, but it gave me a lot of headaches trying to learn it! Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From max.wanadoo at gmail.com Thu Sep 27 14:34:11 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 20:34:11 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: <00d001c8013d$61b90f50$8119fea9@LTVM> John, Or flip the thing around, viz: Function dbc() MsgBox pfGetGoodChars("APN SEQUENCE #$%NUMBER") End Function Public Function pfGetGoodChars(str2Parse As String) As String Const conGoodChars As String = "abcdefghijklmnopqrstuvwxyz" ' acceptable characters Const conQuote As String = """" Dim lng As Long, strTemp As String, bFlipCase As Boolean str2Parse = UCase(Left(str2Parse, 1)) & LCase(Mid(str2Parse, 2)) For lng = 1 To Len(str2Parse) If InStr(conGoodChars, Mid(str2Parse, lng, 1)) > 0 Then If bFlipCase = True Then strTemp = strTemp & UCase(Mid(str2Parse, lng, 1)) bFlipCase = False Else strTemp = strTemp & Mid(str2Parse, lng, 1) End If Else bFlipCase = True End If Next lng pfGetGoodChars = strTemp End Function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 8:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 cfoust at infostatsystems.com Thu Sep 27 15:37:00 2007 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 27 Sep 2007 13:37:00 -0700 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Sorry John, I got confused and replied to the Access list. I posted a couple of RegEx snippets there, but they won't solve your problem all by themselves. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 12:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 Mon Sep 10 12:03:41 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 10 Sep 2007 13:03:41 -0400 Subject: [dba-VB] Driver for GPS sensor Message-ID: <001901c7f3cc$8acce430$6c7aa8c0@M90> I am trying to find VB (preferably) software to directly read the GPS-500 SiRF III GPS sensor that comes with MS streets and trips. I just bought my first telescope and now want to start looking at GPS locator info to feed existing "push to" software. John W. Colby Colby Consulting www.ColbyConsulting.com From Gustav at cactus.dk Wed Sep 19 08:01:33 2007 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 19 Sep 2007 15:01:33 +0200 Subject: [dba-VB] VS2005: Create a rectangle in a PictureBox Message-ID: Hi all I have a form with a PictureBox, and I can load a picture from a file into this. Now I wish to mark (select) a rectangle somewhere inside the picture - you know: mouse-down to mark upper-left corner, draw mouse to lower-right corner, release mouse button - and save the picture with the created rectangle overlayed. Any suggestions on how to achieve this? /gustav From jwcolby at colbyconsulting.com Fri Sep 21 10:38:32 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 11:38:32 -0400 Subject: [dba-VB] Bulk Insert Error. Message-ID: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Fri Sep 21 13:13:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 14:13:14 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> References: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> Message-ID: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From max.wanadoo at gmail.com Fri Sep 21 13:22:53 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Fri, 21 Sep 2007 19:22:53 +0100 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Message-ID: <003f01c7fc7c$6d607250$8119fea9@LTVM> I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver 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 Sep 21 14:36:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 15:36:51 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <003f01c7fc7c$6d607250$8119fea9@LTVM> References: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> <003f01c7fc7c$6d607250$8119fea9@LTVM> Message-ID: <00a901c7fc86$c2d5fed0$6c7aa8c0@M90> ROTFL. Naw, I'm still a complete nubee and so any suggestion is better than what I know. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Friday, September 21, 2007 2:23 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Thu Sep 27 13:33:54 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:33:54 -0400 Subject: [dba-VB] Use Regex - Create Camel Case Message-ID: <005801c80134$f60b9320$6c7aa8c0@M90> Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com From max.wanadoo at gmail.com Thu Sep 27 13:46:52 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 19:46:52 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <00c401c80136$c66049c0$8119fea9@LTVM> John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 Thu Sep 27 13:59:38 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:59:38 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <00c401c80136$c66049c0$8119fea9@LTVM> References: <005801c80134$f60b9320$6c7aa8c0@M90> <00c401c80136$c66049c0$8119fea9@LTVM> Message-ID: <005901c80138$8e73cfd0$6c7aa8c0@M90> LOL, well, that is certainly an option. In fact I am currently doing something similar and realized that I had done a simple substitution. However... I am also getting things like APN SEQUENCE NUMBER. I really want to remove the space and camel case what is left. ApnSequenceNumber. Of course this ignores that APN is an acronym but I cannot really know that. These field names come at me from all angles and I just want to standardize the results so that my tables have readable field names. I am hearing about RegEx, in fact from our group members, so I thought perhaps someone either already had this laying around, or at least had the familiarity to knock one out and explain it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Thursday, September 27, 2007 2:47 PM To: dba-vb at databaseadvisors.com; 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 ridermark at gmail.com Thu Sep 27 14:01:53 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:01:53 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Thu Sep 27 14:09:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 15:09:51 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <005a01c80139$fb68eb60$6c7aa8c0@M90> I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From ridermark at gmail.com Thu Sep 27 14:22:01 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:22:01 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Check out that site on regular expressions - that helped me out a lot. I have a similar situation where the data feed that we get may or may not have everything we want, and almost ALWAYS has more than we are expecting. RegEx has saved me a lot of headaches, but it gave me a lot of headaches trying to learn it! Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From max.wanadoo at gmail.com Thu Sep 27 14:34:11 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 20:34:11 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: <00d001c8013d$61b90f50$8119fea9@LTVM> John, Or flip the thing around, viz: Function dbc() MsgBox pfGetGoodChars("APN SEQUENCE #$%NUMBER") End Function Public Function pfGetGoodChars(str2Parse As String) As String Const conGoodChars As String = "abcdefghijklmnopqrstuvwxyz" ' acceptable characters Const conQuote As String = """" Dim lng As Long, strTemp As String, bFlipCase As Boolean str2Parse = UCase(Left(str2Parse, 1)) & LCase(Mid(str2Parse, 2)) For lng = 1 To Len(str2Parse) If InStr(conGoodChars, Mid(str2Parse, lng, 1)) > 0 Then If bFlipCase = True Then strTemp = strTemp & UCase(Mid(str2Parse, lng, 1)) bFlipCase = False Else strTemp = strTemp & Mid(str2Parse, lng, 1) End If Else bFlipCase = True End If Next lng pfGetGoodChars = strTemp End Function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 8:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 cfoust at infostatsystems.com Thu Sep 27 15:37:00 2007 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 27 Sep 2007 13:37:00 -0700 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Sorry John, I got confused and replied to the Access list. I posted a couple of RegEx snippets there, but they won't solve your problem all by themselves. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 12:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 Mon Sep 10 12:03:41 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 10 Sep 2007 13:03:41 -0400 Subject: [dba-VB] Driver for GPS sensor Message-ID: <001901c7f3cc$8acce430$6c7aa8c0@M90> I am trying to find VB (preferably) software to directly read the GPS-500 SiRF III GPS sensor that comes with MS streets and trips. I just bought my first telescope and now want to start looking at GPS locator info to feed existing "push to" software. John W. Colby Colby Consulting www.ColbyConsulting.com From Gustav at cactus.dk Wed Sep 19 08:01:33 2007 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 19 Sep 2007 15:01:33 +0200 Subject: [dba-VB] VS2005: Create a rectangle in a PictureBox Message-ID: Hi all I have a form with a PictureBox, and I can load a picture from a file into this. Now I wish to mark (select) a rectangle somewhere inside the picture - you know: mouse-down to mark upper-left corner, draw mouse to lower-right corner, release mouse button - and save the picture with the created rectangle overlayed. Any suggestions on how to achieve this? /gustav From jwcolby at colbyconsulting.com Fri Sep 21 10:38:32 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 11:38:32 -0400 Subject: [dba-VB] Bulk Insert Error. Message-ID: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Fri Sep 21 13:13:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 14:13:14 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> References: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> Message-ID: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From max.wanadoo at gmail.com Fri Sep 21 13:22:53 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Fri, 21 Sep 2007 19:22:53 +0100 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Message-ID: <003f01c7fc7c$6d607250$8119fea9@LTVM> I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver 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 Sep 21 14:36:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 15:36:51 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <003f01c7fc7c$6d607250$8119fea9@LTVM> References: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> <003f01c7fc7c$6d607250$8119fea9@LTVM> Message-ID: <00a901c7fc86$c2d5fed0$6c7aa8c0@M90> ROTFL. Naw, I'm still a complete nubee and so any suggestion is better than what I know. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Friday, September 21, 2007 2:23 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Thu Sep 27 13:33:54 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:33:54 -0400 Subject: [dba-VB] Use Regex - Create Camel Case Message-ID: <005801c80134$f60b9320$6c7aa8c0@M90> Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com From max.wanadoo at gmail.com Thu Sep 27 13:46:52 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 19:46:52 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <00c401c80136$c66049c0$8119fea9@LTVM> John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 Thu Sep 27 13:59:38 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:59:38 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <00c401c80136$c66049c0$8119fea9@LTVM> References: <005801c80134$f60b9320$6c7aa8c0@M90> <00c401c80136$c66049c0$8119fea9@LTVM> Message-ID: <005901c80138$8e73cfd0$6c7aa8c0@M90> LOL, well, that is certainly an option. In fact I am currently doing something similar and realized that I had done a simple substitution. However... I am also getting things like APN SEQUENCE NUMBER. I really want to remove the space and camel case what is left. ApnSequenceNumber. Of course this ignores that APN is an acronym but I cannot really know that. These field names come at me from all angles and I just want to standardize the results so that my tables have readable field names. I am hearing about RegEx, in fact from our group members, so I thought perhaps someone either already had this laying around, or at least had the familiarity to knock one out and explain it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Thursday, September 27, 2007 2:47 PM To: dba-vb at databaseadvisors.com; 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 ridermark at gmail.com Thu Sep 27 14:01:53 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:01:53 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Thu Sep 27 14:09:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 15:09:51 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <005a01c80139$fb68eb60$6c7aa8c0@M90> I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From ridermark at gmail.com Thu Sep 27 14:22:01 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:22:01 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Check out that site on regular expressions - that helped me out a lot. I have a similar situation where the data feed that we get may or may not have everything we want, and almost ALWAYS has more than we are expecting. RegEx has saved me a lot of headaches, but it gave me a lot of headaches trying to learn it! Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From max.wanadoo at gmail.com Thu Sep 27 14:34:11 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 20:34:11 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: <00d001c8013d$61b90f50$8119fea9@LTVM> John, Or flip the thing around, viz: Function dbc() MsgBox pfGetGoodChars("APN SEQUENCE #$%NUMBER") End Function Public Function pfGetGoodChars(str2Parse As String) As String Const conGoodChars As String = "abcdefghijklmnopqrstuvwxyz" ' acceptable characters Const conQuote As String = """" Dim lng As Long, strTemp As String, bFlipCase As Boolean str2Parse = UCase(Left(str2Parse, 1)) & LCase(Mid(str2Parse, 2)) For lng = 1 To Len(str2Parse) If InStr(conGoodChars, Mid(str2Parse, lng, 1)) > 0 Then If bFlipCase = True Then strTemp = strTemp & UCase(Mid(str2Parse, lng, 1)) bFlipCase = False Else strTemp = strTemp & Mid(str2Parse, lng, 1) End If Else bFlipCase = True End If Next lng pfGetGoodChars = strTemp End Function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 8:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 cfoust at infostatsystems.com Thu Sep 27 15:37:00 2007 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 27 Sep 2007 13:37:00 -0700 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Sorry John, I got confused and replied to the Access list. I posted a couple of RegEx snippets there, but they won't solve your problem all by themselves. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 12:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 Mon Sep 10 12:03:41 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 10 Sep 2007 13:03:41 -0400 Subject: [dba-VB] Driver for GPS sensor Message-ID: <001901c7f3cc$8acce430$6c7aa8c0@M90> I am trying to find VB (preferably) software to directly read the GPS-500 SiRF III GPS sensor that comes with MS streets and trips. I just bought my first telescope and now want to start looking at GPS locator info to feed existing "push to" software. John W. Colby Colby Consulting www.ColbyConsulting.com From Gustav at cactus.dk Wed Sep 19 08:01:33 2007 From: Gustav at cactus.dk (Gustav Brock) Date: Wed, 19 Sep 2007 15:01:33 +0200 Subject: [dba-VB] VS2005: Create a rectangle in a PictureBox Message-ID: Hi all I have a form with a PictureBox, and I can load a picture from a file into this. Now I wish to mark (select) a rectangle somewhere inside the picture - you know: mouse-down to mark upper-left corner, draw mouse to lower-right corner, release mouse button - and save the picture with the created rectangle overlayed. Any suggestions on how to achieve this? /gustav From jwcolby at colbyconsulting.com Fri Sep 21 10:38:32 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 11:38:32 -0400 Subject: [dba-VB] Bulk Insert Error. Message-ID: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Fri Sep 21 13:13:14 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 14:13:14 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> References: <008a01c7fc65$7830f7c0$6c7aa8c0@M90> Message-ID: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com From max.wanadoo at gmail.com Fri Sep 21 13:22:53 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Fri, 21 Sep 2007 19:22:53 +0100 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> Message-ID: <003f01c7fc7c$6d607250$8119fea9@LTVM> I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 11:39 AM To: dba-sqlserver at databaseadvisors.com Cc: VBA Subject: [dba-SQLServer] Bulk Insert Error. I am getting the following error in a bulk insert. "Received an invalid column length from the bcp client for colid 40." The full error is below. "System.Data.SqlClient.SqlException: Received an invalid column length from the bcp client for colid 40. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec t stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer(Int32 columnCount) at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) at FileImport_CSV.clsCreateTable.mReadFile(String lstrFileSpec) in C:\Documents and Settings\jwcolby\My Documents\Visual Studio 2005\Projects\FileImport-CSV\FileImport-CSV\clsCreateTable.vb:line 260" This is intermittent and occurs after tens of thousands of completed lines inserted by the bulk copy - 160K lines in the latest case. Any idea what this is all about? TryCatch is as follows. Try 'csvdata. bulkCopy.WriteToServer(csvData) mlngRecordsBulkCopied = mlngRecordsRead Catch ex As Exception strStatus = "Bulk Copy FAILED: " & ex.Message mclsDataLogger.cLogData.mMemoWriteLine(strStatus, , True) RaiseEvent evStatus(strStatus, False, True) MessageBox.Show(ex.Message) MessageBox.Show("Could not open the table: " + mstrCnn + ": table: " & mclsIOData.pTblName) Return -1 End Try I am wondering if there is a way to tell the BCP client to retry or something like that. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver 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 Sep 21 14:36:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 21 Sep 2007 15:36:51 -0400 Subject: [dba-VB] [dba-SQLServer] Bulk Insert Error. In-Reply-To: <003f01c7fc7c$6d607250$8119fea9@LTVM> References: <00a701c7fc7b$14af53c0$6c7aa8c0@M90> <003f01c7fc7c$6d607250$8119fea9@LTVM> Message-ID: <00a901c7fc86$c2d5fed0$6c7aa8c0@M90> ROTFL. Naw, I'm still a complete nubee and so any suggestion is better than what I know. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Friday, September 21, 2007 2:23 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. I was going to suggest that but I thought you might think I was stupid! Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Friday, September 21, 2007 7:13 PM To: dba-sqlserver at databaseadvisors.com Cc: 'VBA' Subject: Re: [dba-VB] [dba-SQLServer] Bulk Insert Error. Well, it appears that it was a simple issue of the field size being too small. It was not intermittent at all, my catch was causing the entire function to exit which caused the next file to run which had the same error but at a different record (of course!). Once I traced it down to stopping at exactly the same record every time I decided to go open up the field size for that field (and about 4 similar fields) and the import is happily running now. John W. Colby Colby Consulting www.ColbyConsulting.com From jwcolby at colbyconsulting.com Thu Sep 27 13:33:54 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:33:54 -0400 Subject: [dba-VB] Use Regex - Create Camel Case Message-ID: <005801c80134$f60b9320$6c7aa8c0@M90> Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com From max.wanadoo at gmail.com Thu Sep 27 13:46:52 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 19:46:52 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <00c401c80136$c66049c0$8119fea9@LTVM> John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 Thu Sep 27 13:59:38 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 14:59:38 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <00c401c80136$c66049c0$8119fea9@LTVM> References: <005801c80134$f60b9320$6c7aa8c0@M90> <00c401c80136$c66049c0$8119fea9@LTVM> Message-ID: <005901c80138$8e73cfd0$6c7aa8c0@M90> LOL, well, that is certainly an option. In fact I am currently doing something similar and realized that I had done a simple substitution. However... I am also getting things like APN SEQUENCE NUMBER. I really want to remove the space and camel case what is left. ApnSequenceNumber. Of course this ignores that APN is an acronym but I cannot really know that. These field names come at me from all angles and I just want to standardize the results so that my tables have readable field names. I am hearing about RegEx, in fact from our group members, so I thought perhaps someone either already had this laying around, or at least had the familiarity to knock one out and explain it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Thursday, September 27, 2007 2:47 PM To: dba-vb at databaseadvisors.com; 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"?$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.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 ridermark at gmail.com Thu Sep 27 14:01:53 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:01:53 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005801c80134$f60b9320$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From jwcolby at colbyconsulting.com Thu Sep 27 14:09:51 2007 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 27 Sep 2007 15:09:51 -0400 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: References: <005801c80134$f60b9320$6c7aa8c0@M90> Message-ID: <005a01c80139$fb68eb60$6c7aa8c0@M90> I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From ridermark at gmail.com Thu Sep 27 14:22:01 2007 From: ridermark at gmail.com (Mark Rider) Date: Thu, 27 Sep 2007 14:22:01 -0500 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Check out that site on regular expressions - that helped me out a lot. I have a similar situation where the data feed that we get may or may not have everything we want, and almost ALWAYS has more than we are expecting. RegEx has saved me a lot of headaches, but it gave me a lot of headaches trying to learn it! Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. From max.wanadoo at gmail.com Thu Sep 27 14:34:11 2007 From: max.wanadoo at gmail.com (max.wanadoo at gmail.com) Date: Thu, 27 Sep 2007 20:34:11 +0100 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: <00d001c8013d$61b90f50$8119fea9@LTVM> John, Or flip the thing around, viz: Function dbc() MsgBox pfGetGoodChars("APN SEQUENCE #$%NUMBER") End Function Public Function pfGetGoodChars(str2Parse As String) As String Const conGoodChars As String = "abcdefghijklmnopqrstuvwxyz" ' acceptable characters Const conQuote As String = """" Dim lng As Long, strTemp As String, bFlipCase As Boolean str2Parse = UCase(Left(str2Parse, 1)) & LCase(Mid(str2Parse, 2)) For lng = 1 To Len(str2Parse) If InStr(conGoodChars, Mid(str2Parse, lng, 1)) > 0 Then If bFlipCase = True Then strTemp = strTemp & UCase(Mid(str2Parse, lng, 1)) bFlipCase = False Else strTemp = strTemp & Mid(str2Parse, lng, 1) End If Else bFlipCase = True End If Next lng pfGetGoodChars = strTemp End Function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 8:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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 cfoust at infostatsystems.com Thu Sep 27 15:37:00 2007 From: cfoust at infostatsystems.com (Charlotte Foust) Date: Thu, 27 Sep 2007 13:37:00 -0700 Subject: [dba-VB] Use Regex - Create Camel Case In-Reply-To: <005a01c80139$fb68eb60$6c7aa8c0@M90> References: <005801c80134$f60b9320$6c7aa8c0@M90> <005a01c80139$fb68eb60$6c7aa8c0@M90> Message-ID: Sorry John, I got confused and replied to the Access list. I posted a couple of RegEx snippets there, but they won't solve your problem all by themselves. Charlotte -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 12:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case I have already downloaded it and am playing around. Just looking at all the stuff in Expresso tells me that RegEx can be very complex! John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mark Rider Sent: Thursday, September 27, 2007 3:02 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, You may want to take a look a Expresso for creating and testing the regex - I have found it VERY helpful. It can be found at http://www.ultrapico.com/Expresso.htm and cost is minimal (free). Also check out regular-expressions.info for a good series of tutorials and examples. -- Mark Rider http://dfwmdug.org Don't anthropomorphize computers. They don't like it. _______________________________________________ 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