Running QODBC V8 with VS.Net 2005
I have a Intranet site on our Apps server. QODBC and quickbooks are installed on the same server. QODBC to my knowledge is configured on the apps server to run using Dcom.
on my dev machine i can run the following code .. all be it very slowly ( about 10 mins ) and it pulls up nr last used Invoice number. If i publish the page to the Intranet site and access the page it just hangs. Can anybody, in plain simple terms, show me how to fix this issue.
vb.net code
Imports Microsoft.VisualBasic
Partial Class Bureau_Invoicing
Inherits System.Web.UI.Page
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Const adOpenStatic = 3
Const adLockOptimistic = 2
Dim oConnection
Dim oRecordset
Dim sMsg
Dim sConnectString
Dim sSQL
sConnectString = "DSN=Quickbooks Data;OLE DB Services=-2;OptimizerOn=No"
sSQL = "Select Max(RefNumber) From InvoiceLine"
oConnection = CreateObject("ADODB.Connection")
oRecordset = CreateObject("ADODB.Recordset")
oConnection.Open(sConnectString)
oRecordset.Open(sSQL, oConnection, adOpenStatic, adLockOptimistic)
StartInvNo.Text = oRecordset.Fields(0).value
oRecordset.Close()
oRecordset = Nothing
oConnection.Close()
oConnection = Nothing
End Sub
End Class
ASPX page
<%@ Page AspCompat="true" Language="VB" AutoEventWireup="false" CodeFile="Bureau Invoicing.aspx.vb" Inherits="Bureau_Invoicing" %>
<script runat="server">
Public Sub SetInvoiceDate(ByVal sender As Object, ByVal e As System.EventArgs)
txtInvDate.Text = DateAdd("d", -1, "01/" & CStr(Month(Date.Today)) & "/" & CStr(DatePart("yyyy", Date.Today)))
End Sub
Public Sub SetCollectionDate(ByVal sender As Object, ByVal e As System.EventArgs)
' Collection Date, nearest Banking day on or after 10 of the current month
Dim TempDate As String '= CStr(DateAdd("m", DatePart("m", Date.Today) - 1, "10/01" & CStr(DatePart("yyyy", Date.Today))))
TempDate = CStr(DateAdd("m", DatePart("m", Date.Today) - 1, "10/01/" & CStr(DatePart("yyyy", Date.Today))))
Select Case Weekday(TempDate)
Case 0
' Sunday so add 1 day
txtCollecDate.Text = DateAdd("d", 1, TempDate)
Case 7
' Saturday so add 2 days
txtCollecDate.Text = DateAdd("d", 2, TempDate)
Case Else
' collection date is a week day
txtCollecDate.Text = TempDate
End Select
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Bureau Invoicing</title>
</head>
<body>
<form id="form1" runat="server" >
<div>
Monthly Bureau Invoice Run<br />
<br />
<br />
Start Date :
<ASP:TEXTBOX ID="txtInvDate" runat="server" onload ="SetInvoiceDate" ></ASP:TEXTBOX><br />
Collection Date :
<ASP:TEXTBOX ID="txtCollecDate" runat="server" OnLoad="SetCollectionDate"></ASP:TEXTBOX><br />
<br />
Start Inv No:
<ASP:TEXTBOX ID="StartInvNo" runat="server" > </ASP:TEXTBOX>
<br />
Finish Inv No.
<ASP:TEXTBOX ID="TextBox4" runat="server"></ASP:TEXTBOX></div>
</form>
</body>
</html>
As you can see its nothing complicated that im trying to achieve, but no matter how much reading of threads, i just can not get this to work on the Intranet site, and even running on localhost its very very slow. I think there are only about 7 - 8 thousand invoices in the system. any suggestions would be most appriciated
|