Hi, Sorry I was not clear on what I'm trying to do. In plain English, I have a comma delimited file with 45k+ records that contains zipcode and taxrate. I have a foxpro table that contains countrycode, zipcode and taxrate fields. Now I need to update each taxrate field in the table with value of taxrate field from the flat file. If the zipcode in taxrate table is not found I need to insert a new record. (that is why I have to lookup the zipcode first, I commented that code out and did not include it with my example.) Thank you ipokrov
iluha
Posts
-
VB.NET - OLEDB with Foxpro table -
VB.NET - OLEDB with Foxpro tableHi! I'm trying to run a process that updates a zip/tax rate table. The new tax rates are in a flat file. the table I need to update is a FoxPro free table indexed in country and zipcode fields. Everything is working, but I have 45K+ records to update and after about 15% into the flat file the process it gets slooooow and gets slower and slower. If I comment out the code that does search and just leave the code that goes through the flat file it takes about 30 seconds with the looks up and update it takes 30+ minutes and I can see the progress bar miving for first 15% and than it dies.... I think I am missing something here... Here is what the code looks like: m_conn = New OleDbConnection m_conn.ConnectionString = "Provider=VFPOLEDB.1;" & _ "Data Source=" & g_app_options.processing_folder_path & "output\tax import;" & _ "Mode=ReadWrite|Share Deny None;" & _ "Collating Sequence=MACHINE;" m_conn.Open() Do While srTaxFile.EndOfStream = False ado_command = New OleDb.OleDbCommand("SELECT ZIPCODE FROM zip WHERE country='001' AND ZIPCODE='" & taxRecord.field(cTaxRecord.RecordFieldIDs.ZipCode).Trim & "'", m_conn) Dim sZipCode As String = ado_command.ExecuteScalar() ado_command = New OleDb.OleDbCommand("UPDATE zip SET itaxr = " & taxRecord.field(cTaxRecord.RecordFieldIDs.SalesTaxRate).Trim & " WHERE zipcode='" & taxRecord.field(cTaxRecord.RecordFieldIDs.ZipCode).Trim & "'", m_conn) ado_command.ExecuteNonQuery() set_progress(srTaxFile.BaseStream.Length, srTaxFile.BaseStream.Position) Loop Its pretty simple, and I don't understand why it takes that long. This is running on a local drive. If you can help or know what I'm missing, I would greatly appreciate it! Thank you ipokrov
-
debugging ControlLibrary (dll) called from ASPX pageHello everyone! I have a question that I have been trying to solve and I can find a solution, if you know please share you wisdom! I'm making a DLL that will be used by a ASPX page, this is not an ASP.NET application, just a DLL loaded by the page. very simple, ControlLibrary code: Namespace hello_world Public Class cHello Public ReadOnly Property sayhello() As String Get Return "hello" End Get End Property End Class End Namespace page code: <%@ Page Language="VB" Explicit="False" %> <%@ import Namespace="hello_world" %> Dim aHello As cHello Sub Page_Load(Sender As Object, E As EventArgs) aHello = New cHello() End Sub !!!!!<%=aHello.sayhello()%>!!!!!!!!! Not much and it works, the only problem I can't debug it. when I put the break point on Public ReadOnly Property sayhello() As String nothing happens, I get my hello on the page but it does not stop... as far as I could find it there use to be an option in studio 2003 called "Enable ASP.NET debugging" but I can't find in 2005. Does anyone knows what I need to do? please help! Thank you ipokrov
-
How to call stored procedure from update statementHello, I have a stored procedure called P_DATE_TO_MS that takes 2 parameters DATE & MILLISECOND and I need to call this procedure from an update statement: conConnection.Execute ("UPDATE table SET CURRENT_TIME_IN_MS = P_DATE_TO_MS(getDate()) WHERE id=123") It looks like the stored procedure returns the information in the second variable (ByRef?) and not as a return value. I'm calling the statement through ADODB.Connection object and not in the SQL directly. Please correct me if my assumption is incorrect, I'm not an SQL guy and I'm just getting into SQL Can anyone tell me if this is possible or how to do it. here is the store procedure: CREATE PROCEDURE P_DATE_TO_MS @DATE DATETIME, @MILLISECOND DECIMAL OUTPUT SET @MILLISECOND = TIME_IN_MS END GO Thank you in advance ilya
-
screen saver in vb6.0I don't know what OS this for, but in 2000 & XP there is a function called GetLastInputInfo. The function parameter is LASTINPUTINFO structure:
Private Type LASTINPUTINFO cbSize As Long ' = 8 dwTime As Long End Type
As far as the time you can add a windows timer (SetTimer) or add a timer control (vb) You can compare the LASTINPUTINFO.dwTime against GetTickCount() function to calculate the time elapsed. Hope this helps:) iluha -
vbScript include questionHi everyone! I have a question. I have a vbScript (.vbs) file that sends emails using outlook. I now want to have that file as include file in other vbScript files like ASP allows you to do: But I can not find the way to do it. Is it possible to have a include in .vbs script file? Does not make sense to have the same code in 2 files if you can make it an include, does it?:confused: But I can't find a way... if any of you know how please let me know. Thank you in advance! iluha:)
-
Subclassing SysListView32 in activex control problemHello, I'm creating a new activex control using MFC ActiveX control wizard. my activex control subclasses SysListView32. Everything works except for drawing the control when i use WS_EX_CLIENTEDGE style. If i don’t call this function DoSuperclassPaint(pdc, rcBounds); the items in the control are not painted, but the column header is visible. If I do call this function, the items are painted, but there is an extra line below the column header and when you scroll there are lines going across the control where that it extra line was painted. It seems line the control dc is shifted 2 pixel right and 2 pixels down. When I dont use WS_EX_CLIENTEDGE style everything is fine. expect there is not 3d appearance. If anyone knows how to solve this problem PLEASE HELP. Thank you Ilya
-
Custom data type in ActiveX propertyHello, I making an activex control in C++. I need to create a property handler that will take in an enum: enum Views { aVIEW_DETAILS = LV_VIEW_DETAILS, aVIEW_ICON = LV_VIEW_ICON, aVIEW_LIST = LV_VIEW_LIST, aVIEW_SMALLICON = LV_VIEW_SMALLICON, aVIEW_TILE = LV_VIEW_TILE, } ViewType; ViewType CvbFileListCtrl::get_viewtype() { } void CvbFileListCtrl::set_viewtype(ViewType NewValue) { } Does anyone knows how to do this? Please help!!! iluha
-
SELECT and UPDATE in one statementHi everyone I'm working a program that needs to interface with a dBase 3 and pull records (sometimes limited amount) based on a zip code field. Also i need to pull the oldest records first by using MAILED field. I came up with this query to pull the data: SELECT TOP 5 * INTO DESTINATON.dbf FROM SOURCE.dbf WHERE ZIP5 = '95003' ORDER BY MAILED ASC This query works. It select top 5 record, creates DESTINATON.dbf witch is identical in structure to SOURCE.dbf and populates it with selected records. The hard part is to update the MAILED field in the same query, so next time I don't use the same records. There in no unique field that i can use to match pulled records to the SOURCE.dbf and update it. I want to do it all in one shot, but I'm not sure that this is possible. I'm using ADO 2.7 Any help is greatly appreciated. Thank you Ilya :eek:
-
Can I keep a connection open while the session exists?I'm developing a shopping cart using vb6. (ActiveX dll) For db connectivity I'm using ADO 2.7 The database (free tables) in use for now will be FOXPRO (I know not the best choice) At some point the databases will be converted to MSSQL. My question is: When the cCustomer class is created, can I open the connection to the database and closed it when class is destroyed (on session end)? Or Should I open and close connection as needed? It just seem better to just do it ones, but I'm not sure on how much extra load it will be on the server. There might be up to 500 people on the server at any given time... Please let me know what you think Thank you Iluha :)
-
Debuging VB.NET Class library project used in asp pagesHello everyone! I'm trying to debug a vb.net project and it is not working like I expected. In the vb6 I would open the project set my break points and run it. When ever the line that has the break point was called from asp page running locally it would stop. It does not work the same in vb.net Can some one tell me what am I doing wrong or a where I can find a good article about debugging Class library project. :omg: Thanks in advance Iluha
-
ActiveX Dll project in Visual Basic.netI found the problem! Public Sub New() MyBase.New() g_dbConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" End Sub as soon as i commented the "g_dbConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" line it started to work. Can some one tell me, can i have extra code in the sub new ? besides the MyBase.New()? :confused:
-
ActiveX Dll project in Visual Basic.netHello everybody! I'm new to the Visual basic.net and I'm trying to create a ActiveX dll project to use on server side in my asp pages. I have created several of similar projects in vb6 and never had a problem. I created a new Class library project. Added ComClass tag with ClassID, InterfaceId and EventsID. I checked the "Register for COM Interop" in project properties. I created test asp page that calls Server.CreateObject("appname.classname") and this is when I get the error "object reference not set to an instance of an object" Does any one know why this happens? :confused: Thank you for any help! iluha
-
I Need Help Copying FilesHere is some code that will go through the directory copy you files. Option Explicit Private Const MAX_PATH = 260 Private Const FILE_ATTRIBUTE_DIRECTORY = &H10 Private Const INVALID_HANDLE_VALUE = -1 Private Type FileTime dwLowDateTime As Long dwHighDateTime As Long End Type Private Type WIN32_FIND_DATA dwFileAttributes As Long ftCreationTime As FileTime ftLastAccessTime As FileTime ftLastWriteTime As FileTime nFileSizeHigh As Long nFileSizeLow As Long dwReserved0 As Long dwReserved1 As Long cFileName As String * MAX_PATH cAlternate As String * 14 End Type Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long Private Sub Form_Load() On Error Resume Next Dim hSearch&, FileData As WIN32_FIND_DATA, aFolderName$ hSearch& = FindFirstFile("\\server\clients\*.*", FileData) If hSearch& <> INVALID_HANDLE_VALUE Then Do If FileData.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY Then aFolderName$ = Mid$(FileData.cFileName, 1, InStr(1, FileData.cFileName, vbNullChar) - 1) Select Case aFolderName$ Case ".", ".." 'skip Case Else CopyFile "\\server\clients\" & aFolderName$ & "\diagram.htm", "\\server\network_diagram\" & aFolderName$ & "\diagram.htm", True End Select End If FileData.cFileName = "" Loop While FindNextFile(hSearch&, FileData) FindClose (hSearch&) End If End Sub :zzz: iluha
-
Closing recordset objectHello I have a small question. Do i need to call the Recordset.Close before i set it to nothing? Or the destructor will close it? Set oRsAdmin = oDb.Execute("SELECT * FROM tbAdmin " & _ "WHERE User = '" & UserId$ & "'") oRsAdmin.Close Set oRsAdmin = Nothing OR Set oRsAdmin = Nothing Thank you Ilya :confused:
-
Triggering vbcode in assess from a server side asp codeHello everyone, I have a question about vb + assess + asp. If i write a code in vb in the access database is there a way to run this code from server side asp. What i want to do is add a function to assess database that searches the access table to find out if this person has already been on the site. Does anyone knows if this possible?:confused: And y is there a vb editor in access???:) Thank you Ilya
-
SQL Select statmentDear Steve Thank you very much!!! I tried with ' around before, but i completely forgot about # signs. It works like magic now. Thank you Ilya P. :)
-
SQL Select statmentHello everybody! Can some one please tell me what am i doing wrong here? Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between 4/1/2003 AND 4/30/2003") This does not return any records and i know that there are records with dates in that range I have tried <= => nothing works Thank you very much!!! ilya P.
-
ADO + SQL + FOXPRO Question/problemHello, I have a problem that i cannot solve. The problem shows up in XP, the code works fine in 98SE Please if you know the answer help me The code: conITEMS.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDb=" & "D:\work\old" rsITEMS.CursorLocation = adUseClient rsITEMS.Open "SELECT * FROM STOCK", conITEMS, adOpenStatic, adLockPessimistic rsITEMS.MoveFirst rsITEMS.Find ("number = '2004'") This is where it fails with error = Run-time error '2147467259 (80004005)' "data provider or other service returned an E_FAIL status" Thank you in advance Ilya :(
-
Problem setting the value in textareaIt works now Thank you very much!!!! ilya :)