Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

RichardBerry

@RichardBerry
About
Posts
124
Topics
44
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • File Synchronization/Backup
    R RichardBerry

    I would like to create a small app to synchronize/backup various groups of files or folders between a flashdrive, home pc and work pc. Any comments to ensure good speed and reliability regarding the following would be appreciated: 1) To determine which files have changed, <pre> Dim di As New DirectoryInfo(Path) Dim files As FileSystemInfo() = di.GetFiles Dim fi As FileInfo 'Loop through files and see when last modified, and add to a datatable             For Each fi In files                         dr = dtFiles.NewRow                         dr.Item(0) = diNext.Name                         dr.Item(1) = dr.Item(0) = diNext.LastWriteTime                         dtFiles.Rows.Add(dr)          Next </pre> Is this OK, or would it be better to check CRC of the files to find the ones that have changed? I was thinking more along the lines of determining which is the NEWEST file, and then making the sync Bi-Directional though 2) Once I have found the files that are newer, then use: <pre>System.IO.File.Copy("Sourcefile", "DestinationFile")</pre> To verify file copied correctly, maybe just put above in a Try... Catch... Or should I check CRC or something to see if copied correctly? 3) If anyone has done something similar, are there any pitfalls or things I should watch out for? Tks.

    Visual Basic performance question

  • Problem with Excel Sheet name when importing using oledb
    R RichardBerry

    Hi I have tried various options with the quotes with no sucess. Once I have selected the workbook from which I want to import the sheet, I load the sheets in the workbook into a combo. The user can then select which sheet they want to import. I do this as follows: For Each sheet As Excel.Worksheet In xlPacklistBook.Sheets Me.cboPackListSheetSelect.Items.Add(sheet.Name) Next Regarding the second option, I did try using the sheet index, but that did not work. I suspect it is because in the following code, the command data type is a string: Dim cmd As New System.Data.OleDb.OleDbCommand("Select * from ['" & strSheet & "$.A:A]'", conn) In Excel VBA if you use Sheet(1) as a ref to a sheet, the one is an int value, not a string as in Sheet("mySheet") I'm trying th e third option at the moment, but having hassles - I'll let you know if I get it right..

    Visual Basic help database learning

  • Problem with Excel Sheet name when importing using oledb
    R RichardBerry

    Thanks, tried them but no luck. The '$' sign is eqivalent to the '!' usually used to indicate a sheet in an Excel Formula. I tried the same query in MS Query from Excel, and it gave the similar syntax and it works with the '-' at the end. The only difference was it the Filed name was as follows SELECT * FROM mysheetName$.F1 Do you know how to use an escape character for '-'. Mabee I can get the sheet name, strip off the dash, and insert a dash with an escape character sequence?

    Visual Basic help database learning

  • Problem with Excel Sheet name when importing using oledb
    R RichardBerry

    Hi Using VS2005 VB I am having Problems when importing data from an Excel sheet using oledb The sheets being opened as always use the following naming convention P_W03-29M40MH-S16A-1235296-XFA- The problem seems to be the dash at the end. If I rename the sheet and replace the dash with an underscore, it works fine I dont want to have to open the book first an rename the sheets every time. The code below throws an error when cmd.Execute reader executes. The error states: System.Data.OleDb.OleDbException = {"The Microsoft Jet database engine could not find the object 'P_W03-29M40MH-S16A-1235296-XFA-$.A:A'. Make sure the object exists and that you spell its name and the path name correctly."} This is the code I am using: Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\myFile.xls;" & _ "Extended Properties=""Excel 8.0;HDR=NO""" Dim conn As New System.Data.OleDb.OleDbConnection(strConn) conn.Open() Dim strSheet As String = "P_W03-29M40MH-S16A-1235296-XFA-" Dim cmd As New System.Data.OleDb.OleDbCommand("Select * from [" & strSheet & "$A:A]", conn) Dim rdr As OleDbDataReader = cmd.ExecuteReader

    Visual Basic help database learning

  • Excel - Specify File Type in Save as (Excel 97-2003)
    R RichardBerry

    Found my answer... Use one of the Interop.Excel.XlFileFormat formats Interop.Excel.XlFileFormat.xlExcel8 seems to work fine

    Visual Basic question help announcement learning

  • Excel - Specify File Type in Save as (Excel 97-2003)
    R RichardBerry

    Hi I need to save an Excel file as (Excel 97-2003) For the code below, I have a reference to Microsoft Excel 12.0 Object Library, which I assume is for Excel 2007. When I open a workbook saved as below, I get an error message saying the workbook is not in the expected format. Previously I used a reference to Excel 10.0 which worked fine, but I cannot find that anymore when adding references. I guess I have two choices: a) How do I reference Excel 10.0 Object Library? or b) In the code below, what do I replace "FileFormat As Object" with to specify that the file must be saved as an older Version? Private Sub ExportExcel() Dim xlApp As New Excel.Application Dim xlBook As Excel.Workbook xlBook = xlApp.Workbooks.Add 'Write stuff to book here... xlBook.SaveAs("MyBook.xls", "FileFormat As Object") xlBook.Close() xlBook = Nothing xlApp.Quit() xlApp = Nothing GC.Collect() End Sub

    Visual Basic question help announcement learning

  • question about vb6.0..data type conversion
    R RichardBerry

    Which line gives the error?

    farah mazhar wrote:

    Text1.Text = i

    Perhaps the problem is: Text1.Text (String Datatype) = i (Byte Datatype) MisMatch... Not sure why you convert Integer to string, and then back to string for the Textbox? This may be of interest (but its vb.Net so not sure about VB6): Convert a decimal value to binary, octal, or hexadecimal The ToString method of the Convert class lets you easily and quickly convert a decimal value into a string representation of that number to binary, octal, or hexadecimal base: ' convert to binary Convert.ToString(11, 2)) ' => 1011 ' convert to octal Convert.ToString(123, 8)) ' => 173 ' convert to hexadecimal Convert.ToString(254, 16)) ' => fe The ToString method is overloaded to take a Byte, a Short, an Integer, or a Long value in the first argument; the second argument can only be 2, 8, 10, or 16, else an exception will be thrown -- modified at 6:18 Thursday 8th November, 2007

    Visual Basic help csharp question

  • How to make the system sleep for a while.
    R RichardBerry

    System.Threading.Thread.Sleep(1000) '1000 Milli Second delay Or you can use a different thread to do the population of the files. Private Sub PopulateFiles ..... End Sub Use the lines below in one of your Procedures, which then calls the PopulateFiles procedure on a new thread. Dim thPopulateFiles As New System.Threading.Thread(AddressOf PopulateFiles) thPopulateFiles.Start() It can be tricky if you access the file before the new thread has finished executing - maybe look at Thread.Join as well.

    Visual Basic question csharp json tutorial

  • RS232 - "Stealth Mode"
    R RichardBerry

    Hi I have a small app using the IO.Ports.SerialPort class. (VS2005 - Visual Basic) Can anybody point me in the right direction to make this app MONITOR data transfer on a particular port in both directions, but not interfere it. So basically if I have an application communicating with an external device on a particular serial port, I want to be able to log the data that the app sends to the device and the data the device sends back to the pc, but it must not interfere?

    Visual Basic question

  • SQL to get DataTypes
    R RichardBerry

    Hi Colin Thanks that was exactly what I was looking for.

    Colin Angus Mackay wrote:

    I'm also curious, did it not occur to you just to type SELECT * FROM INFORMATION_SCHEMA.COLUMNS or search for references to it on the internet?

    No it did not occur to me, since I looked through all the databases on the server, and could not find a table with that name, so I thought perhaps this was a table that was not in my database. I had never heard of a 'view' before, so I am currently GOOGLING 'SQL View' to learn more about that. It is sometimes difficult for a NOVICE (myself) to ask the right questions or look in the right places for information.

    Database database question

  • SQL to get DataTypes
    R RichardBerry

    Hi John Got it right - my syntax was wrong - I was putting in the '@' before the table name. BTW, is there a way to get more the info on all tables at once? I tried Exec sp_columns [*] but that gave no data back? Thanks for your help!!

    Database database question

  • SQL to get DataTypes
    R RichardBerry

    Hi John Thanks for your reply. I tried running that stored procedure from MS Query, and get the following fields returned,but with no data. TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, COLUMN_NAME, DATA_TYPE..... Etc It would actually be great if I could get all table data for the database in the above format. When executing 'Exec sp_columns [@TableName]' I tried replacing 'TableName' with various strings but cant seem to get any data back. I tried *, vektron.scheme.units, scheme.units, units. But none seemed to work. Typically to execute a normal Select query, I would use: SELECT * FROM vektron.scheme.units Any idea what I could be doing wrong?

    Database database question

  • SQL to get DataTypes
    R RichardBerry

    Hi Colin Yes Using SQL server, but how do I do this? I looked, but don't seem to find a table with this name (INFORMATION_SCHEMA.COLUMNS)?

    Database database question

  • SQL to get DataTypes
    R RichardBerry

    Hi Is it possible to write a query that will return the datatype of each field as opposed to actual data? tks Richard

    Database database question

  • SELECT MAX
    R RichardBerry

    Hi Kschuler I tried it, but it maxed out the processor, and seemed to hang. I will only be able to look at it again in the morning, but thanks for your reply in the mean time BTW, the podetm table has about 14000 records, and the poheadm table about 5000 records. Maybe thats why its slow? -- modified at 11:03 Thursday 30th August, 2007

    Database database sql-server sysadmin help

  • SELECT MAX
    R RichardBerry

    Hi Chris That did not work either, I got multiple results for each product. One entry in the PoHeadm table can have many line Items in Podetm table The same product can appear many times in the podetm table, but each with a different order_no, and hence a different date_entered in the header table. I tried to write a statement in English stating what I want, hoping that I could develop that into an SQL statement, but even that proved difficult. Select each item from podetm, and return the product and cost of the order number that has the latest date_entered in the poheadm table???? Maybe if you have time to spend, you could try to write a statement based on the data below? Header Table: Poheadm Fields: |date_entered |order_no| Data: |2007-05-28 |00001 | Data: |2007-05-29 |00002 | Detail Table: podetm Fields: |order_no |local_expec_cost |product| Data: |00001 | USD5.06 |AA01 | Data: |00001 | USD1.00 |AA02 | Data: |00001 | USD9.00 |AA03 | Data: |00002 | USD7.00 |AA01 | Data: |00002 | USD2.00 |AA04 | So above we have TWO Purchase orders. Order 00001, has 3 line items. Order two has 2 line items. As you can see, product AA01 is on TWO purchase orders, I want to create a list of EACH of the products in podetm, and I want the LAST price paid based on the date_entered field in the poheadm table. So for the above, the data I want returned would look as follows (each product is ONLY ONCE, and has the latest price and date): |product |local_expect_cost |date_enetered| |AA01 |USD7.00 |2007-05-29 | (Data from Latest Date Order2) |AA02 |USD1.00 |2007-05-28 | (Only Ordered once) |AA03 |USD9.00 |2007-05-29 | |AA04 |USD2.00 |2007-05-29 |

    Database database sql-server sysadmin help

  • SELECT MAX
    R RichardBerry

    Hi I also tried pulling the SQL tables into Access and running the same query, but had to change the line: max(poh.date_entered) last_date to max(poh.date_entered) AS last_date ???? But then it returns many records for each product, wheras I only want to return ONE record for EVERY product, and that record must be the once which has the latest date Maybe I explained what I'm trying to do badly, so if you get a chance, perhaps look at my reply to Kschuler's post as I try to explain what I want in more detail...

    Database database sql-server sysadmin help

  • SELECT MAX
    R RichardBerry

    Tks 4 reply Tried the statement you suggest, but get the following Error: Could not add the table '('.

    Database database sql-server sysadmin help

  • SELECT MAX
    R RichardBerry

    HI Yes, one order can have many products. E.g. One entry in the PoHeadm table can have many line Items in Podetm table Header Table: Poheadm Fields: |date_eneterd |order_no| Data: |2007-05-28 |00001 | Data: |2007-05-29 |00002 | Detail Table: podetm Fields: |order_no |local_expec_cost |product| Data: |00001 | USD5.06 |AA01 | Data: |00001 | USD1.00 |AA02 | Data: |00001 | USD9.00 |AA03 | Data: |00002 | USD7.00 |AA01 | Data: |00002 | USD2.00 |AA04 | So above we have TWO Purchase orders. Order 00001, has 3 line items. Order two has two line items. As you can see, product AA01 is on two purchase orders, I want to create a list of ALL products, and I want the last price paid. So for the above, the data I want returned would look as follows (each product is ONLY ONCE, and has the latest price and date): |product |local_expect_cost |date_enetered| |AA01 |USD7.00 |2007-05-29 | (Data from Latest Date Order2) |AA02 |USD1.00 |2007-05-28 | (Only Ordered once) |AA03 |USD9.00 |2007-05-29 | |AA04 |USD2.00 |2007-05-29 |

    Database database sql-server sysadmin help

  • SELECT MAX
    R RichardBerry

    Hi Using MS Query for Excel connecting to a SQL Server 2000 database through ODBC. I am trying to get the last purchase Order price for all products There are two tables containing the info I need: Table: poheadm (Purchase Order Header) order_no date_entered Table: podetm (Purchase Order Detail) order_no product local_expect_cost (i.e. the price) The following statement gives an error "Could not add the table "(SELECT." SELECT podetm.product, podetm.cost FROM podetm podetm, (SELECT max(poheadm.date_entered) as maxdate, poheadm.order_no FROM poheadm poheadm GROUP BY order_no) maxresults WHERE podetm.order_no = maxresults.order_no The following statement runs, but I get multiple results for each product, not just the latest price SELECT podetm.product, podetm.local_expect_cost, (SELECT max(poheadm.date_entered) FROM poheadm poheadm WHERE poheadm.order_no = podetm.order_no) FROM podetm podetm

    Database database sql-server sysadmin help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups